Hi friends,
I'm developing some WDK components and need to get access to the java objects HttpServletRequest and HttpServletResponse.
Does anyone know how to reach those objects from a Component?
Tks,
Marcelo
Hello Marcelo,
You can get handle to PageContext (javax.servlet.jsp.PageContext) in your component class using getPageContext() method (which is exposed by Form class). Once you have handle of PageContext you can get request and response objects as:
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse res = (HttpServletResponse) pageContext.getResponse();
-Tejraj
Hello Tejraj,
After accessing this response object we can not use it because it throws IllegalStateException for every operation like getOutputStream() or getWriter() etc.
will you please let us know how to access these objects like Outputstream and Writer of response object
Thanks
Yogesh
Hello Yogesh,
Normally we do not work with Response object in WDK/WebTop customization, can you please explain what are you trying to achieve.
If you try to get handle of writer object from response before calling super.onInit method of your component, it should not throw exception.