|
Page Edited :
WICKET :
Raw HttpServletRequest
Raw HttpServletRequest has been edited by Elyboy (Nov 10, 2008). Change summary: just corrected the typo HttpServletRequest to HttpServletResponse How to get access to the raw HttpServletRequest and HttpServletResponse objectsIn 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 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(); From within a subclass of WebPage you can do something similar by getting hold of the web request cycle: HttpServletRequest request = getWebRequestCycle().getWebRequest().getHttpServletRequest(); HttpServletResponse response = getWebRequestCycle().getWebResponse().getHttpServletResponse(); |
Unsubscribe or edit your notifications preferences
