You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by George Baxter <gb...@shutterfly.com> on 2008/09/10 00:23:19 UTC
Replaceing RequestFacade
Hello,
For various and sundry reasons, I need to wrap the original
HttpServletRequest with a facade of my own. I know that the
HttpServletRequest exposed by Catalina is a RequestFacade object. I simply
wrap my facade around this puppy.
And... when my jsp attempts to render... boom:
java.lang.ClassCastException: com.xxx.request.MyTestRequestFacade
at org.apache.catalina.core.ApplicationDispatcher.unwrapRequest(ApplicationDispatcher.java:814)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:401)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
I tried to extend the RequestFacade, but cannot because the constructor
requires a org.apache.catalina.connector.Request, and I cannot get a hold of
that. Is there anything I can do to encourage tomcat to instantiate my
request facade instead its own?
Using Tomcat 5.5 at present.
Thanks,
Re: Replaceing RequestFacade
Posted by George Baxter <gb...@shutterfly.com>.
Argh, I feel so stupid. Thank you for bonking me on the head. Feel free to bonk harder next time.
Thanks!
George
On 9/9/08 5:53 PM, "Bill Barker" <wb...@wilshire.com> wrote:
Your facade has to extend (Http)ServletRequestWrapper from the standard
servlet-api. According to the spec, that is the only valid way to wrap a
request. As you've seen, Tomcat enforces this restriction :).
"George Baxter" <gb...@shutterfly.com> wrote in message
news:C4EC4567.4599%gbaxter@shutterfly.com...
Hello,
For various and sundry reasons, I need to wrap the original
HttpServletRequest with a facade of my own. I know that the
HttpServletRequest exposed by Catalina is a RequestFacade object. I simply
wrap my facade around this puppy.
And... when my jsp attempts to render... boom:
java.lang.ClassCastException: com.xxx.request.MyTestRequestFacade
at
org.apache.catalina.core.ApplicationDispatcher.unwrapRequest(ApplicationDispatcher.java:814)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:401)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
I tried to extend the RequestFacade, but cannot because the constructor
requires a org.apache.catalina.connector.Request, and I cannot get a hold of
that. Is there anything I can do to encourage tomcat to instantiate my
request facade instead its own?
Using Tomcat 5.5 at present.
Thanks,
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Replaceing RequestFacade
Posted by Bill Barker <wb...@wilshire.com>.
Your facade has to extend (Http)ServletRequestWrapper from the standard
servlet-api. According to the spec, that is the only valid way to wrap a
request. As you've seen, Tomcat enforces this restriction :).
"George Baxter" <gb...@shutterfly.com> wrote in message
news:C4EC4567.4599%gbaxter@shutterfly.com...
Hello,
For various and sundry reasons, I need to wrap the original
HttpServletRequest with a facade of my own. I know that the
HttpServletRequest exposed by Catalina is a RequestFacade object. I simply
wrap my facade around this puppy.
And... when my jsp attempts to render... boom:
java.lang.ClassCastException: com.xxx.request.MyTestRequestFacade
at
org.apache.catalina.core.ApplicationDispatcher.unwrapRequest(ApplicationDispatcher.java:814)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:401)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
I tried to extend the RequestFacade, but cannot because the constructor
requires a org.apache.catalina.connector.Request, and I cannot get a hold of
that. Is there anything I can do to encourage tomcat to instantiate my
request facade instead its own?
Using Tomcat 5.5 at present.
Thanks,
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org