But when you /need to/, you need to. So we don't give you direct access to these things, we /do/ allow you to get access. Instead of one call away, it is now two method calls away.
And Scott, yes you can add this to the wiki. I would like to have a warning at the top, stating that it is not 'the Wicket way'. But sometimes there are moments you need to get messy.
Martijn
On 9/29/05, Scott Sauyet <[EMAIL PROTECTED]> wrote:
I found an unfortunate need to have access to the raw
HttpServletRequest/Response objects. (The application will be running
inside Plumtree Portal, which uses these objects.) I didn't find any
documentation for this, and it took me a little digging to find it. I
was thinking of adding the below to "How to" section of the wiki.
Is this the appropriate way to get at these objects? Is it appropriate
for the wiki?
Comments? Suggestions?
======================================================================
How to get access to the raw HttpServletRequest and
HttpServletResponse objects
In an ideal world, this wouldn't be necessary. But we all know how ideal
our world really is! In my case it was a need to connect to a portal
which required access to the HttpServletRequest and HttpServletResponse.
Note that for most uses, Component's getRequest() and getResponse()
methods will give you objects you can use.
But if you find you need access to these objects you can get them in
this manner:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import wicket.markup.html.WebMarkupContainer;
import wicket.protocol.http.servlet.ServletWebRequest ;
[ ... ]
ServletWebRequest servletWebRequest = (ServletWebRequest) getRequest();
HttpServletRequest request = servletWebRequest.getHttpServletRequest();
WebResponse webResponse = (WebResponse) getResponse();
HttpServletResponse response = webResponse.getHttpServletResponse();
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
