[jboss-user] [JBoss Portal] - Re: JBoss Portal - Clustering - Http Session Replication

chellva do-not-reply at jboss.com
Thu Dec 28 08:50:25 EST 2006


Hi,
" My intention is to test HTTP Session Replication" feature. I have downloaded the HelloWorld portlet and added the following code in doEdit()

 protected void doEdit(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
   {
      rResponse.setContentType("text/html");
      PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/edit.jsp");
      
      PortletSession session = rRequest.getPortletSession();
   	  session.setAttribute("Session Replication", " Session Replication Value ");
      
      prd.include(rRequest, rResponse);
   }

And in doView() i am printing value of the session variable

protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
   {
	rResponse.setContentType("text/html");

      String sYourName = (String) rRequest.getParameter("yourname");

      if(sYourName != null)
      {
         rRequest.setAttribute("yourname", sYourName);
         PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view2.jsp");
         
         PortletSession session = rRequest.getPortletSession();
         System.out.println( " SESSION NAME  doView " + session.getClass().getName());
        	 System.out.println( " HTTP Session Replication Value " + session.getAttribute("Session Replication"));

I have deployed this war file along with jboss-portal-ha-2.4.0 and deployed in all folder.
I am running "run -c all" in 2 machines in the same network.
I am using load balancer to route the HTTP request to 2 machines. 
doEdit() HTTP request is going to JBOSS in machine 1 and it is adding the value in session. After adding the value in the session i bring down machine1. So the next HTTP request, doView() is going to Machine2. But the value in the session variable is coming as null in machine 2.



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

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



More information about the jboss-user mailing list