-
1. Re: How to access query parameters in portlet.doView()
theute Feb 13, 2009 7:35 AM (in response to rashmitambe)Look at shared parameters (feature of JBoss Portal 2.7/EPP 4.3) if you really want to do this. This is explained in the reference guide.
You won't access the http request parameter like this, this would bring collisions risks.
(Say you add another portlet on the page with the category parameter which is something else). This is why the spec defines render parameters. -
2. Re: How to access query parameters in portlet.doView()
jssteux Feb 23, 2009 8:13 AM (in response to rashmitambe)Here is an example that works in jbp 2.6.7. It can be used in an interceptor (such as PageCustomizeInterceptor)
// Retrieve portal object
PortalObject portal = objContainer.getContext().getDefaultPortal();
PortalObject gestionPerso = portal.getChild("gestionEspacePerso");
PortalObject windowPerso gestionPerso.getChild("GestionEspacePersoPortletWindow");
// Set parameters
PortletParametersStateString parameters = new PortletParametersStateString();
parameters.setValue("init", "true");
// Perform a render URL on the target window
InvokePortletWindowRenderCommand renderCmd = new InvokePortletWindowRenderCommand(windowPerso.getId(),
Mode.VIEW, null, parameters);
URLContext urlContext = cmd.getControllerContext().getServerInvocation().getServerContext()
.getURLContext();
String url = cmd.getControllerContext().renderURL(renderCmd, urlContext,URLFormat.newInstance(true, true));
// forwards the url cmd.getControllerContext().getServerInvocation().setAttribute(Scope.REQUEST_SCOPE,
"org.jboss.portal.header.MY_URL", url);