[jboss-user] [JBoss Portal] - Re: WSRP Producer: Need to set requiresInitCookie

jgrange do-not-reply at jboss.com
Mon Sep 1 07:31:57 EDT 2008


I've investigated the problem futher and it appears that the SharePoint WSRP web part is sending the JSESSIONID cookie on getMarkup requests but not on performBlockingInteraction requests.

The consequence of this is that a new session is created for processAction in my test portlet (source code below), but not for each doView.

BTW:  The actionURL.toString()+"/wsrp_rewrite" bit was needed to get sharepoint to rewrite the action url.  the /wsrp_rewrite at the end of the action url was there under portal 2.4.2, but appears to have disappeared for 2.6.6 - would you like that as a separate post?


package org.jboss.portlet.hello;

import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.UnavailableException;
import java.io.IOException;
import java.io.PrintWriter;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletMode;
import javax.portlet.PortletPreferences;
import javax.portlet.PortletURL;
import javax.portlet.WindowState;

public class HelloWorldPortlet extends GenericPortlet
{

    public void processAction(ActionRequest request, ActionResponse response) throws PortletException { 
     
        // process the salutation set by the user in the edit mode. 
        
        String username = request.getParameter("username"); 
        request.getPortletSession().setAttribute("username", username);
    	Integer count = (Integer) request.getPortletSession().getAttribute("accesscount");
    	System.out.println("username = " + username + ", count = " + count);
        

        
        }

    protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException, UnavailableException
    {
        // prompt the user for the salutation. 
        
    	Integer count = (Integer) request.getPortletSession().getAttribute("accesscount");
    	if (count == null) {
    		count = new Integer(0);
    	}
    	
    	count++;
    	
    	request.getPortletSession().setAttribute("accesscount", count);
    	String username = (String) request.getPortletSession().getAttribute("username");
                PortletURL actionURL = response.createActionURL(); 
         
                response.setContentType(request.getResponseContentType()); 
         
                PrintWriter writer = response.getWriter(); 
         
//                writer.write("<form method=\"post\" action=\"" + actionURL.toString()); 
                writer.write("<form method=\"post\" action=\"" + actionURL.toString()+"/wsrp_rewrite"); 
         
                writer.write("\">Name:<INPUT TYPE=\"TEXT\" NAME=\"username\"><INPUT TYPE=\"submit\" NAME=\"SUB1\" VALUE=\"Submit\">");   
                writer.write("Hello " + username + ".  Access count=" + count + "");
    

        writer.close();
    }
    protected void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException, UnavailableException
    {  
    	doView(request, response);
    }
}


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173590#4173590

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173590



More information about the jboss-user mailing list