You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Alexander Malyshev (JIRA)" <je...@portals.apache.org> on 2010/08/18 15:24:17 UTC

[jira] Created: (JS2-1206) Request parameters are copied to the navigational state (and encoded in _ns part of URL) when using JSR 286 eventing.

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

                 Key: JS2-1206
                 URL: https://issues.apache.org/jira/browse/JS2-1206
             Project: Jetspeed 2
          Issue Type: Bug
          Components: Components Core
    Affects Versions: 2.2.1
         Environment: Windows XP x32 SP3, JRE1.6.0_21
            Reporter: Alexander Malyshev


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: How can I set IFrame portlet preferences programmatically

Posted by David Sean Taylor <d....@onehippo.com>.
On Mon, Aug 23, 2010 at 8:40 PM, Vuong Nguyen <vu...@yahoo.com> wrote:
>
> Hi all,
>
> I am newbie to Jetspeed. I would like to set IFrame portlet's height and SRC url
> Could anyone show me (or give some hints on) how to programmatically do that (I
> prefer to use AJAX or client side APIs).
>
With portlets we make use of the preferences feature of the portlet
api quite a bit. There are two IFrame portlets documented here:

http://portals.apache.org/applications/webcontent/index.html

The ReverseProxyIFramePortlet can size to fit its content
automatically by setting the AUTORESIZE preference

> Also, if anyone can show me some places to look at client API to manipulate the
> portlet (add/show/hide), that would be great.
>

All possible with the Jetspeed REST API... hopefully the operations
are adequately documented for you:

http://portals.apache.org/jetspeed-2/devguide/guide-rest-api.html

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


How can I set IFrame portlet preferences programmatically

Posted by Vuong Nguyen <vu...@yahoo.com>.
Hi all,

I am newbie to Jetspeed. I would like to set IFrame portlet's height and SRC url
Could anyone show me (or give some hints on) how to programmatically do that (I 
prefer to use AJAX or client side APIs).

Also, if anyone can show me some places to look at client API to manipulate the 
portlet (add/show/hide), that would be great.

I am using 2.2.1.

Thanks much for your help.

Vuong Nguyen
Sequent Infosystems Limited
http://www.sequent-it.com