Using Portal 6.1.01. I'm using the url generation discussed in http://www-01.ibm.com/support/docview.wss?rs=688&uid=swg21265900. The generation code is directly from wp.l2.urlhelper.jar attached to that document.
I'm in the LoginUserAuth class in doPostLogin, so my user has authenticated. I am using the below code to generate a url to a specific page (authenticated) within portal and portlet. I'm trying to pass parameters from LoginUserAuth to the portlet so I can use them in the render phase. Here is the snippet of code:
ObjectID pageoid = IdentificationHelper.getObjectID(REDIRECT_PAGE_OID);
ObjectID portletoid = IdentificationHelper.getObjectID(REDIRECT_PORTLET_OID);
targetURLStr = OffLineURLHelper.generateUrl(pageoid, portletoid, map, serverContext, true);
runData.setRedirectURL(targetURLStr);
return;
The OIDs come directly from the xmlaccess script, so I know they are both correct. The map contains just one value that needs to be passed to the portlet.
When this runs, my user is redirected to the correct page in Portal and the portlet displays on the page. However, no parameters appear in the render phase according to the code below.
In the portlet code, I do the following:
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
log.debug("Process the view");
Enumeration enummer = request.getParameterNames();
while(enummer.hasMoreElements()){
String parmName = (String) enummer.nextElement();
log.debug("Render param = " + parmName);
}
....
My log shows that I got to the render phase OK, but there are no parameter names showing up.
Any suggestions for what could be wrong? Is it possible to pass render parameters from the offline url generation while in LoginUserAuth?
Update, I wasn't getting anywhere trying to get the render parameters, so I decided to use another form of the generateURL method in the OffLineURLHelper to get into the action phase of the view mode. Here is the call:
The resulting url is: http://my61portal.perficient.com:10040/wps/myportal/!ut/p/c4/04_SB8K8xLLM9MSSzPy8xBz9CP0os3hzf28zDw8LA0t3zxBDA0-DYM9gb9NAQwMjU_1I_ShjJHk_PwOQvFdQkJuFgYGBmX5EWWZquX4IyNzC0tSiyuKSosy8dP3IpJzEDBBWy4svSExPtS3OAgG1AggvGwyAhkfiNTw8MRnkTP2C7Mjc-FxHRQC5NMWk/
In this case, I still reach the correct page, but I get the following error in the log and the action phase is not called:
WPActionPhase W com.ibm.wps.engine.phases.WPActionPhase processPortlets EJPEI0170E: Cannot execute the received action com.ibm.wps.engine.commands.StandardActionDispatcher@271a271a due to a security violation. The action URL needs to contain an action ID.
Does anybody have any ideas about the action ID or the OffLineURLHelper class?
Did you try your suggestion on Portal 6.1 and a JSR 168 portlet? Here is the result of that.
Here is the doView code:
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
//Test code from developer works
HttpServletRequest servletRequest = (HttpServletRequest) request;
log.debug("Got the servletRequest");
if (servletRequest.getQueryString() != null)
{
String queryString = servletRequest.getQueryString();
log.debug("queryString >>>>>" + queryString);
}else log.debug("queryString >>>>> is null");
....
And the results:
(doView) - Got the servletRequest
(doView) - queryString >>>>> is null
According to the JSR 168/286 spec (PLT.19.3.8): On the other hand, the portlet does not have direct access to the path and query information of the client request as it is one component rendered on the page.
Because the first generated URL is targeting to a unprotected area, but the authentication had been finished already Security does force a logout. This logout does stop the parameters for the JSR168 Portlet been added to the State of the current executed request.
The 2. problem which occurs (if you send it to a protected URL, may be caused by the Code made available in the technote. The error does show that an action is send to a portlet (what you expect) but Portal does expect in such case an action ID to track the action and prevent double execution.
Thanks for your reply. i can see this url (http://localhost:10038/wps/portal/searchItems?itemId=vapp&location=germany) when i hover my mouse on a link in my source portlet. both are jsr168 portlets.
when i click this, i could see the destination portlet displaying all the search items irrespective of item id and location as these two are coming as null values.
1. I don't this my destination portlet is an unprotected area neither it is forcing logoff.
2. i could see the parameters if i use wiring but can't get parameters when i use query string url.
how can i see the values?? please let me know how to get HttpServletRequest in portal 6.1 (JSR168 portlets).
You cannot get query string parameters in JSR 168 portlets - the jsr spec doesn't allow portlets to get the query string.
Here are a couple of thoughts.
1. If you are trying to send data from one portlet to another, the way to do that is via wiring, not the query string. It sounds like you have that working somewhat. You will need to set up WSDL files in both portlets - the source will publish your id and location values, while the target portlet will consume them.
2. If you move up to JSR286 portlets, you can set public render parameters in the source portlet and then grab those render parameters in the target portlet.
3. If you are trying to pass parameters from outside of portal (like in a servlet, for example) and you want to target the parameters to a specific portlet, you can use Portal's URI Resolver service. The following article explains it pretty well, but you will have to modify it to target just one portlet. http://www.ibm.com/developerworks/websphere/library/techarticles/0710_koeth/0710_koeth.html
I have the similar requirement as you mentioned below.
My requirement is :
I have a servlet with an HyperLink and i am using the OfflineURLGenerator.generateUrlString(page_name,portlet_name,null,serverContext,true);
within the generateUrlString method i have added the setTarget method by setting the target as PORTLET_ACTION and portletname as arguments.
So ultimately i could generate the targeturl and i can see the target page and portlet, but it is not calling the processAction method.
url : http://localhost:10040/wps/myportal/testvp/!ut/p/c4/04_SB8K8xLLM9MSSzPy8xBz9CP0os3gDQwtPXyNjE0P_sABXA08TZ283J-8gQ39nI_1IPPIWpqZA-Ui88uGJySCb9Auy03wBaGtRHA!!/
It gives me the below error:
10/9/09 15:59:12:310 PDT 00000037 WPActionPhase W com.ibm.wps.engine.phases.WPActionPhase processPortlets EJPEI0170E: Cannot execute the received action com.ibm.wps.engine.commands.StandardActionDispatcher@a8b0a8b due to a security violation. The action URL needs to contain an action ID.
Can you please help me out on this. i am in great urgent.