tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Ward" <cw...@horizon-asset.co.uk>
Subject RE: Repeated "load-on-startup" niggle
Date Fri, 23 Jan 2004 17:11:02 GMT
> 
> I would use sendRedirect in this case for two reasons:
> - To really make it look/act as if the request was for the /hal URL,
> - To avoid getting a RequestDispatcher for a resource outside 
> your docBase
> 
> sendRedirect would preserve all the request parameters, 
> including POST data.


Hi Yoav,

Below is the filter I've been using.  It seems to mostly work,
but any image files from a path such as "/images/Delete.gif"
seem to not get updated to "/hal/images/Delete.gif" in the
HTML.

However, the output I get to System.out *does* show the filter
processing these requests.  Any ideas?  Is this the correct way
to implement the filter?

Chris




    public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain)
        throws IOException, ServletException 
    {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) resp;
        
        
        try
        {
System.out.println( "REQ : getRequestURI   : " + request.getRequestURI()
);
            String filteredURL = "/hal"+request.getRequestURI();
System.out.println( filteredURL );
            //chain.doFilter(request, response);      
 
response.sendRedirect(response.encodeRedirectURL(filteredURL));

        } 
        catch (IOException io) 
        {
            System.out.println ("IOException raised in Filter");
        }   
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message