Hello, I would like to alter the request URI in my ServletFilter to intercept requests to resources that should only be available to logged in users.
I have found a solution in the archive: http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg64446.html which basically suggests to terminate the doFilter method with request.getRequestDispatcher(/* where to */).forward(request, response); and don't invoke chain.doFilter as the last step. It seems to me that it should not be done this way -- what if there are other legitimate filters that should process the request? Also, I am not sure about the semantics of calling "forward" from "doFilter" -- is it officially supported or maybe a "grey area" of the spec, and it works just by chance? Anyway, I thought that I could achieve the same by using a HttpServletRequestWrapper, like below: request = new HttpServletRequestWrapper(request) { public String getRequestURI() { return "/solonline/page/nosession.jsp"; } public StringBuffer getRequestURL() { return new StringBuffer( "http://192.168.0.1:6080/solonline/page/nosession.jsp"); } public String getServletPath() { return "/page/nosession.jsp"; } }; chain.doFilter(request, response); Unfortunately, the result is an error page: --- HTTP Status 400 - Invalid path /page/nosession was requested type Status report message Invalid path /page/nosession was requested description The request sent by the client was syntactically incorrect (Invalid path /page/nosession was requested). --- Note the ".jsp" stripped from my URI in this error message (?) I am using Apache Tomcat/4.1.18-LE-jdk14. Can someone explain why it does not work as expected? So far I have not found a single example of HttpServletRequestWrapper's usage. Best regards - Jan Ploski -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>