Uploaded image for project: 'Jetspeed 2 (Retired)'
  1. Jetspeed 2 (Retired)
  2. JS2-1206

Request parameters are copied to the navigational state (and encoded in _ns part of URL) when using JSR 286 eventing.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2.1
    • None
    • Components Core
    • None
    • Windows XP x32 SP3, JRE1.6.0_21

    Description

      I'm using the following software to run JSF inside the portlet on top of JetSpeed 2:
      1) JetSpeed2 v2.2.1 bundled with Tomcat v6.0.18 (includes Pluto v2.0.1 as a portlet container)
      2) JBoss Portlet Bridge v2.0.0 Final as a portlet bridge
      3) Mojarra v1.2_14 as a JSF implementation
      4) RichFaces v3.3.3 as a tag library.

      I made 2 simple JSF portlets to test JSR286 Inter Portlet Communication (Eventing and PRP) in the environment above. PRP works fine but I have an issue with Eventing. One of my portlets contains button which sends an Event and another contains message field with the value from an Event.

      All works fine but after several clicks on the button ((1-30) depends on the number of event receiver portlets and total length of all parameters in the request which is generated on the click) Jetspeed closes the connection with the browser and stops returning the portal page.

      During investigation I've found that button URL length grows with each click and after it reaches some critical length IOException is thrown in Coyote Http11Processor (saying Header length is too big or something like that), but it is catched and there is nothing in the logs.

      During further investigation I've found that _ns part of the URL grows because parameters which sent with the form submit are copied to navigational state and encoded in redirect URL (which is sent after action and event are processed). So, each time I'm pressing the button this redirect URL contains more and more encoded parameters (from initial request) as well as button URLs on the Generator portlet .

      The issue happens because the same SessionFullExtendedNavigationalState object is used while ActionRequest and EventRequest are processed and it contains parameters submitted with the form as requestParameters. If some code tries to get parameters from ActionRequest or EventRequest, the parameters are actially requested from SessionFullExtendedNavigationalState. this If my understanding is correct, EventRequest should not contain parameters, submitted with the form as it has nothing to do with them. And when portlet bridge processes this EventRequest, it copies parameters from EventRequest object to EventResponse object (MyFaces portlet bridge does the same so I think it is not a bug in Jboss Portlet Bridge), which actually puts these parameters to PortletURLProviderImpl object and they are encoded in the _ns portion of URL after request is fully processed.

      To fix an issue I had to implement custom NavigationalState which extends SessionFullExtendedNavigationalState (to be able to clean request parameters from navigational state when container processes an Events set to ActionResponse) and custom EventCoordinationService to call clean method in NavigationalState before EventRequest is processed as follows:

      package com.enterprise.portal.state;

      import java.util.Collections;

      import org.apache.jetspeed.cache.JetspeedContentCache;
      import org.apache.jetspeed.container.state.impl.NavigationalStateCodec;
      import org.apache.jetspeed.container.state.impl.SessionFullExtendedNavigationalState;

      public class CustomNavigationalState extends
      SessionFullExtendedNavigationalState {

      public CustomNavigationalState(NavigationalStateCodec codec,JetspeedContentCache cache)

      { super(codec, cache); }

      public CustomNavigationalState(NavigationalStateCodec codec, JetspeedContentCache cache, JetspeedContentCache decorationCache)

      { super(codec, cache, decorationCache); }

      public CustomNavigationalState(NavigationalStateCodec codec,
      JetspeedContentCache cache, JetspeedContentCache decorationCache,
      boolean clearStateOnPageChangeEnabled)

      { super(codec, cache, decorationCache, clearStateOnPageChangeEnabled); // TODO Auto-generated constructor stub }

      public void cleanRequestParameters()

      { requestParameterMap = Collections.emptyMap(); }

      }

      and

      package com.enterprise.portal.service;

      import java.util.List;

      import javax.portlet.Event;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;

      import org.apache.jetspeed.Jetspeed;
      import org.apache.jetspeed.aggregator.PortletTrackingManager;
      import org.apache.jetspeed.container.state.NavigationalState;
      import org.apache.jetspeed.events.EventCoordinationServiceImpl;
      import org.apache.jetspeed.events.PortletEventQueue;
      import org.apache.jetspeed.request.RequestContext;
      import org.apache.jetspeed.security.SecurityAccessController;
      import org.apache.jetspeed.statistics.PortalStatistics;
      import org.apache.pluto.container.PortletContainer;
      import org.apache.pluto.container.PortletWindow;

      import com.enterprise.portal.CustomNavigationalState;

      public class CustomEventCoordinationService extends EventCoordinationServiceImpl{

      public CustomEventCoordinationService(PortletEventQueue eventQueue,
      PortalStatistics statistics,
      PortletTrackingManager portletTracking,
      SecurityAccessController accessController,
      boolean checkSecurityConstraints)

      { super(eventQueue, statistics, portletTracking, accessController, checkSecurityConstraints); }

      @Override
      public void processEvents(PortletContainer container, PortletWindow wnd,
      HttpServletRequest servletRequest,
      HttpServletResponse servletResponse, List<Event> events) {
      RequestContext rc = Jetspeed.getCurrentRequestContext();
      NavigationalState ns = rc.getPortalURL().getNavigationalState();
      if (ns instanceof CustomNavigationalState)

      { ((CustomNavigationalState)ns).cleanRequestParameters(); }

      super.processEvents(container, wnd, servletRequest, servletResponse, events);
      }
      }

      Also I had to modify portal-url-generation.xml and pluto-services.xml files for jetspeed to pick up my custom classes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            amalysh Alexander Malyshev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: