Accessing URL Parameters in a JSR 286 Portlet?
is there a way to access UR开发者_如何转开发L parameters in a Jetspeed2 Portlet/Portal?
like: www.bla.com/portal/page.psml?param=12345
I can only find some tools for liferay (PortalUtil.java) to access the httpservletrequest, but as far as i know there is no such thing for jetspeed?
I thought the public render parameters can be used for such thing, but i'm a little confused here? Didn't anyone had this problem before?
thanks in advance :)
found the answer:
Until version 2.1, Jetspeed merged portal request parameters with portlet specific parameters, effectively allowing "shared" parameters. This is not compliant with the JSR-168 PLT.11, so by default this is now disabled.
By setting merge.portal.parameters.with.portlet.parameters=true this feature can be "restored". In the situation of portal and portlet parameters with the same name, by default the portlet parameters will be provided first in the values array, but this too can be overridden by setting merge.portal.parameters.before.portlet.parameters=true
Setting both these properties to true will deliver the "old" pre-2.1 behavior. Note: for individual portlets, these global settings can be overridden by setting these properties as metadata in jetspeed-portlet.xml
merge.portal.parameters.with.portlet.parameters=false merge.portal.parameters.before.portlet.parameters=false
To use public render parameters from the 2.0 spec
Don't know if it works for jetspeed, but you can try getting the httprequest like this:
HttpServletRequest httpRequest = (HttpServletRequest) request.getAttribute("javax.servlet.request");
Then find the query string in a header like this:
String referer = httpRequest.getHeader("referer");
You'll then have the full page referer so you can parse the query string.
精彩评论