Author: julien(a)jboss.com
Date: 2008-02-10 17:20:27 -0500 (Sun, 10 Feb 2008)
New Revision: 9924
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
Log:
create better window ids in portal demo (request URI + sequence number)
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-10
20:44:21 UTC (rev 9923)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerFilter.java 2008-02-10
22:20:27 UTC (rev 9924)
@@ -88,7 +88,7 @@
PortletInvoker invoker =
(PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
//
- PortalPrepareResponse prepareResponse = new PortalPrepareResponse(resp);
+ PortalPrepareResponse prepareResponse = new PortalPrepareResponse(req, resp);
// Discover existing portlets on the page (introspection phase)
chain.doFilter(req, prepareResponse);
@@ -235,7 +235,7 @@
}
//
- PortalRenderResponse renderResponse = new PortalRenderResponse(resp, context,
pageState, prepareResponse);
+ PortalRenderResponse renderResponse = new PortalRenderResponse(req, resp, context,
pageState, prepareResponse);
//
chain.doFilter(req, renderResponse);
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java 2008-02-10
20:44:21 UTC (rev 9923)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalPrepareResponse.java 2008-02-10
22:20:27 UTC (rev 9924)
@@ -26,6 +26,7 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletOutputStream;
import javax.xml.namespace.QName;
import java.io.IOException;
@@ -67,9 +68,9 @@
/** . */
private Map<QName, PageParameterDef> paramDefs;
- public PortalPrepareResponse(HttpServletResponse response) throws
PortletInvokerException
+ public PortalPrepareResponse(HttpServletRequest request, HttpServletResponse response)
throws PortletInvokerException
{
- super(response);
+ super(request, response);
//
this.windowDefs = new HashMap<String, WindowDef>();
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-10
20:44:21 UTC (rev 9923)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalRenderResponse.java 2008-02-10
22:20:27 UTC (rev 9924)
@@ -43,6 +43,7 @@
import org.jboss.portal.common.util.ParameterMap;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
import javax.xml.namespace.QName;
import java.util.Map;
import java.util.HashMap;
@@ -65,12 +66,13 @@
private Map<String, WindowResult> windowResults;
public PortalRenderResponse(
+ HttpServletRequest request,
HttpServletResponse response,
PagePortletControllerContext portletControllerContext,
PageNavigationalState pageState,
PortalPrepareResponse prepareResponse) throws PortletInvokerException
{
- super(response);
+ super(request, response);
//
Set<QName> pageParameterNames = prepareResponse.getPageParameterNames();
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-10
20:44:21 UTC (rev 9923)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/PortalResponse.java 2008-02-10
22:20:27 UTC (rev 9924)
@@ -26,6 +26,7 @@
import javax.servlet.http.HttpServletResponseWrapper;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
/**
* Expose stuff common to action and render response.
@@ -39,9 +40,19 @@
/** . */
private int count = 0;
- public PortalResponse(HttpServletResponse response) throws PortletInvokerException
+ /** . */
+ private final String pageId;
+
+ public PortalResponse(HttpServletRequest request, HttpServletResponse response) throws
PortletInvokerException
{
super(response);
+
+ // We don't keep a ref to the request since this will be used mainly during in
a dispatch to a JSP
+ // and the info returned by a request after a dispatch are not the same than before
(like the path info).
+ String pageId = request.getRequestURI();
+
+ //
+ this.pageId = pageId;
}
/**
@@ -50,6 +61,6 @@
*/
public String nextId()
{
- return "" + count++;
+ return pageId + "/" + count++;
}
}