How to get HttpServletRequest in JSR 168/286 portlets as it does not extend Servlets?

Getting HttpServletRequest is very easy on JSR 168/ 286 portlets although that is not recommended because portlet itself provides PortletRequest that contains most of the attributes that HttpServletRequest contains.

In doview() method, use the below code


HttpServletRequest httpServletRequest = (HttpServletRequest) (com.ibm.ws.portletcontainer.portlet.PortletUtils.getHttpServletRequest(renderRequest));

No comments:

Post a Comment