request.setContextPath("/jetspeed");
request.setServletPath("/portal");
request.setPathInfo("stuff");
request.setRequestURI("/jetspeed/portal/stuff");
JetspeedRequestContext context = new JetspeedRequestContext(request, response, config, null );
// create base PortletURL
PortalURL url = component.createURL(context.getRequest(), context.getCharacterEncoding());
context.setPortalURL(url);
PortletWindow window = new PortletWindowImpl("111");
PortletWindow window2 = new PortletWindowImpl("222");
PortletWindow window3 = new PortletWindowImpl("333");
HashMap parameters = new HashMap();
parameters.put("test",new String[]{"one","two","three"});
String portletURL = url.createPortletURL(window,parameters,PortletMode.EDIT,WindowState.MAXIMIZED,true,false);
String navStateParameterName = Jetspeed.getContext().getConfigurationProperty("portalurl.navigationalstate.parameter.name", AbstractPortalURL.DEFAULT_NAV_STATE_PARAMETER);
if ( useQueryStringPortalURL )
{
request.setupAddParameter(navStateParameterName,portletURL.substring(portletURL.indexOf('=')+1));
}
else
{
request.setPathInfo(portletURL.substring(portletURL.indexOf("/portal")+7));
}
context = new JetspeedRequestContext(request, response, config, null );
url = component.createURL(context.getRequest(), context.getCharacterEncoding());
context.setPortalURL(url);
NavigationalState nav = url.getNavigationalState();
// Check that they come out correctly
assertTrue("window mode is not set", nav.getMode(window).equals(PortletMode.EDIT));
assertTrue("window state is not set", nav.getState(window).equals(WindowState.MAXIMIZED));