I remember seeing the spec that you can't do this, you have to provide a
ServletRequestWrapper implementation
Filip
Yuri de Wit wrote:
I am not sure I should have posted this question to the dev mailing list,
let me know if that should be the case.
I am using Tomcat 5.5.16.
I have a series of chained HttpServlets in my web app. The first
servlet is
registered with the web.xml and the following ones are dispatched
manually.
Before delegating the HTTP request to the next internal servlet, I am
wrapping the HttpServletRequest overriding getPathInfo() and
getServletPath(). If the pathInfo was /a/b and servletPath was /x, after
wrapping the request getPathInfo returns /b and the servletPath returns
/x/a. The reason I am doing this is that I would like forward and
includes
to work relative to my internal pathInfo and servletPath (/b and /x/a)
instead of the web container one (/a/b and /x).
The first problem I encountered was that if I implemented the wrapper by
subclassing HttpServletRequestWrapper Tomcat implementation unwraps it
before forwarding and the final url contains the original path info
appended
and my custom path info.
So I then changed my implementation and now I am wrapping the request
using
my own subclass of HttpServletRequest instead. Now the problem is that
I get
a ClassCast exception @ org.apache.catalina.core.ApplicationDispatcher
line
814 ("current = ((ServletRequestWrapper) current).getRequest();").
Shouldnt that casting be conditional?
Is there a safer way of implementing the functionlity I described above?
thanks.
- yuri
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]