tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Vendelbo" <hvende...@bluprints.com>
Subject Servlet Filter modifying RequestURL
Date Mon, 28 Jun 2004 21:23:08 GMT
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);

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message