user1097901
user1097901

Reputation: 1

Retrieve public render parameter from OrignalParameterMap in renderRequest

I have passed a render parameter from one portlet to another using user friendly url navigation.

response.setRenderParameter("params", renderParams);
response.sendRedirect(response.encodeURL("/wps/myportal/Home/abcPortlet"), "params");

Here Home and abcPortlet are user friendly page names for specific pages.

While debugging I found that OriginalParameterMap contains the render parameter in its URL.

Can someone tell me how to retrieve it? As usual getter methods are not able to retrieve that value.

Upvotes: 0

Views: 1265

Answers (1)

Apps
Apps

Reputation: 3389

You cannot pass render parameters from one portlet to another. It has to be Pubic Render Parameter (PRP). The approach of setting PRP is same as that of render parameter, but both portlets should agree that, they support that PRP. For that you need to register the supported PRPs in portlet.xml file of both the portlets. Please refer to this link for more info.This is what the specification insist. Imagine a scenario where in we have multiple portlets from various vendors on a portal page. It is a security concern if one portlet could retrieve the parameters from the URL even if it is not targeted to that portlet.

Another approach (which is not recommended) is to type case the RenderRequest to HttpServletRequest and get the parameter from request. It is not mentioned in the specification that PortletRequest should be a HttpServletRequest. So it is better not to do that. Future implementation of Portal can change this.

Third approach is to use the URL Generation APIs and construct the URL which has the parameters targeting the portlet. You can refer to the below link which has some helper classes. This will simplify your job. Advanced URL Generation Helper Classes

The best way is to use PRP. Both the source portlet and target portlet are loosely coupled.

Upvotes: 2

Related Questions