I am trying to use a Filter for a bit of URL rewriting.

Although the request.getRequestURL() documentation states that changing the content of 
the returned StringBuffer is an intended us, it doesn't seem to have much effect. The 
DefaultServlet is still chosen to create a response. The context path is "/sports".

The following does not seem to do the trick, what am I doing wrong. If I need to use a 
HttpServletRequestWrapper, will I have to overrid all path getters ?

Henrik

HttpServletRequest req = (HttpServletRequest)_req;

String uri = req.getRequestURI();

StringBuffer urlBuffer = req.getRequestURL();

if (uri.equals("/sports") || uri.equals("/sports/")) {

urlBuffer.setLength(0);

urlBuffer.append("/sports/welcome");

}

chain.doFilter(req,res);

Reply via email to