how can i get the PortletRequest

EddyR picture EddyR · May 21, 2013 · Viewed 12k times · Source

My problem is to obtain PortletRequest from HttpServletRequest

I put this sentence:

PortletRequest request = (PortletRequest) HttpServletRequest.getAttribute();

What should I put into the .getAttribute();

When I developed in IBM Portlet Factory, I used .getAttribute(Constants.PORTLET_REQUEST) The Constants are into one .jar

Now I need to do this with Portlet in JSR168 or there is another way to obtain PortletRequest without using HttpServletRequest

I hope you can help me

Answer

Ramakrishna picture Ramakrishna · Mar 30, 2015

You can use something like this:

(PortletRequest) request.getAttribute("javax.portlet.request");
(PortletResponse) request.getAttribute("javax.portlet.response");

Request and response are of HTTPServletRequest and HTTPSevletResponse.