Request parameters from a portlet in eXo/GateIn

Portlet specs does not provide a standard way to read a parameter from the request within a portlet, for example to get the myparameter parameter in http://localhost/portal?myparameter=myvalue.

request.getParameter() within a portlet does not help since the request object is a PortletRequest, not the HttpRequest.

An easy solution in eXo/GateIn is to use the getRealRequest method of the concrete implementation of PortletRequest of GateIn. So, in order to retrieve the myparameter param from the request in the render phase, you can do :

((org.gatein.pc.portlet.impl.jsr168.api.RenderRequestImpl) request).getRealRequest().getParameter("myparameter")
Advertisements

, ,

  1. #1 by Bruce Wayne on 01/11/2012 - 15:34

    Which library do I need and how to get it (maven depencendy would be nice) to import the RenderRequestImpl? I did not find any jar or nothing from internet.

    • #2 by Thomas on 17/11/2012 - 00:54

      The class is in the pc-portlet library. The maven artifact is org.gatein.pc:pc-portlet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: