Author: julien(a)jboss.com
Date: 2008-02-03 11:12:29 -0500 (Sun, 03 Feb 2008)
New Revision: 9721
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
Log:
- improved implementation of PortletRequest delegating to the underlying
HttpServletRequest (it should use the most accurate request during a dispatch)
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -1,51 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public interface APIConstants
-{
- /** . */
- String JAVAX_PORTLET_TITLE = "javax.portlet.title";
-
- /** . */
- String JAVAX_PORTLET_SHORT_TITLE = "javax.portlet.short-title";
-
- /** . */
- String JAVAX_PORTLET_KEYWORDS = "javax.portlet.keywords";
-
- /** . */
- String JAVAX_PORTLET_CONFIG = "javax.portlet.config";
-
- /** . */
- String JAVAX_PORTLET_REQUEST = "javax.portlet.request";
-
- /** . */
- String JAVAX_PORTLET_RESPONSE = "javax.portlet.response";
-
- /** . */
- String JAVAX_PORTLET_LIFECYCLE_PHASE = "javax.portlet.lifecycle_phase";
-}
Copied:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java
(from rev 9707,
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/APIConstants.java)
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class Constants
+{
+
+ private Constants()
+ {
+ }
+
+ /** . */
+ public static final String JAVAX_PORTLET_TITLE = "javax.portlet.title";
+
+ /** . */
+ public static final String JAVAX_PORTLET_SHORT_TITLE =
"javax.portlet.short-title";
+
+ /** . */
+ public static final String JAVAX_PORTLET_KEYWORDS =
"javax.portlet.keywords";
+
+ /** . */
+ public static final String JAVAX_PORTLET_CONFIG = "javax.portlet.config";
+
+ /** . */
+ public static final String JAVAX_PORTLET_REQUEST = "javax.portlet.request";
+
+ /** . */
+ public static final String JAVAX_PORTLET_RESPONSE =
"javax.portlet.response";
+
+ /** . */
+ public static final String JAVAX_PORTLET_LIFECYCLE_PHASE =
"javax.portlet.lifecycle_phase";
+}
Property changes on:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/Constants.java
___________________________________________________________________
Name: svn:executable
+
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/DispatchedHttpServletRequest.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -25,22 +25,23 @@
import org.jboss.portal.common.http.QueryStringParser;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.ParameterMap;
-import org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ActionRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.EventRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ResourceRequestImpl;
-import org.jboss.portal.portlet.impl.jsr168.api.ClientDataRequestImpl;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.portlet.PortletSession;
import javax.portlet.PortletRequest;
+import javax.portlet.ClientDataRequest;
+import javax.portlet.ActionRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.EventRequest;
+import javax.portlet.RenderRequest;
import java.security.Principal;
import java.util.Enumeration;
import java.util.Locale;
@@ -111,7 +112,7 @@
private final PortletRequest preq;
/** . */
- private final HttpServletRequest dreq;
+ private final HttpServletRequestWrapper dreq;
/** . */
private final Map<String, String[]> parameters;
@@ -133,8 +134,8 @@
public DispatchedHttpServletRequest(
Dispatch dispatch,
- PortletRequestImpl preq,
- HttpServletRequest dreq,
+ PortletRequest preq,
+ HttpServletRequestWrapper dreq,
ServletContext servletContext)
{
super(dreq);
@@ -265,6 +266,8 @@
if (s != null)
{
Map<String, String> containerAttributes =
containerAttributesStack.getLast();
+
+ //
if (containerAttributes.containsKey(s))
{
return containerAttributes.get(s);
@@ -275,28 +278,23 @@
{
return null;
}
+
+ //
+ return preq.getAttribute(s);
}
-
- //
- return ((PortletRequestImpl)preq).getAttributes().getAttribute(s,
(HttpServletRequest)getRequest());
+ else
+ {
+ return null;
+ }
}
public final Enumeration getAttributeNames()
{
- Set<String> names =
Tools.toSet(((PortletRequestImpl)preq).getAttributes().getAttributeNames(null));
+ Set<String> names = Tools.toSet(preq.getAttributeNames());
- // Add super stuff that is not reserved
- for (Enumeration e = super.getAttributeNames();e.hasMoreElements();)
- {
- String name = (String)e.nextElement();
+ //
+ names.removeAll(ALL_CONTAINER_ATTRIBUTES);
- //
- if (!ALL_CONTAINER_ATTRIBUTES.contains(name))
- {
- names.add(name);
- }
- }
-
//
names.addAll(containerAttributesStack.getLast().keySet());
@@ -505,6 +503,20 @@
return "HTTP/1.1";
}
+ // ******
+
+ public void setRequest(ServletRequest servletRequest)
+ {
+ // That's a trick
+ dreq.setRequest(servletRequest);
+ }
+
+ public ServletRequest getRequest()
+ {
+ // That's a trick
+ return dreq.getRequest();
+ }
+
String[] pushDispatch(Dispatch dispatch)
{
String path = dispatch.getPath();
@@ -643,6 +655,54 @@
containerAttributesStack.removeLast();
}
+ /**
+ * Returns the an implementation of
<code>javax.servlet.http.HttpSession</code> that wraps this
+ * portlet session and use the specified scope for manipulating attributes. This
session is used
+ * during the request dispatch to a servlet.
+ *
+ * @param scope the scope
+ * @return the wrapped session
+ */
+ private HttpSession getSession(boolean create, int scope)
+ {
+ if (session == null)
+ {
+ session = new DispatchedHttpSession[2];
+ }
+
+ // Dereference an existing session if necessary
+ if (session[scope] != null && !session[scope].isValid())
+ {
+ session[scope] = null;
+ }
+
+ // If we have a session here we are sure it is valid and ok to return it
+ if (session[scope] != null)
+ {
+ // So we do nothing
+ }
+ else if (create)
+ {
+ // For sure we need a session we will obtain a valid one
+ PortletSession portletSession = preq.getPortletSession();
+ session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ }
+ else
+ {
+ // Here we can try an existing session but it may return null
+ PortletSession portletSession = preq.getPortletSession(false);
+
+ //
+ if (portletSession != null)
+ {
+ session[scope] = new DispatchedHttpSession(this, portletSession, scope);
+ }
+ }
+
+ //
+ return session[scope];
+ }
+
// Subclasses
public static abstract class ClientData extends DispatchedHttpServletRequest
@@ -652,9 +712,9 @@
private PortletServletInputStream in;
/** . */
- private final ClientDataRequestImpl cdreq;
+ private final ClientDataRequest cdreq;
- public ClientData(Dispatch dispatch, ClientDataRequestImpl cdreq,
HttpServletRequest dreq, ServletContext servletContext)
+ public ClientData(Dispatch dispatch, ClientDataRequest cdreq,
HttpServletRequestWrapper dreq, ServletContext servletContext)
{
super(dispatch, cdreq, dreq, servletContext);
@@ -707,7 +767,7 @@
/** . */
private final InputStream in;
- private PortletServletInputStream(ClientDataRequestImpl req) throws IOException
+ private PortletServletInputStream(ClientDataRequest req) throws IOException
{
in = req.getPortletInputStream();
}
@@ -722,7 +782,7 @@
public static final class Action extends ClientData
{
- public Action(Dispatch dispatch, ActionRequestImpl areq, HttpServletRequest dreq,
ServletContext servletContext)
+ public Action(Dispatch dispatch, ActionRequest areq, HttpServletRequestWrapper
dreq, ServletContext servletContext)
{
super(dispatch, areq, dreq, servletContext);
}
@@ -731,7 +791,7 @@
public static final class Resource extends ClientData
{
- public Resource(Dispatch dispatch, ResourceRequestImpl rreq, HttpServletRequest
dreq, ServletContext servletContext)
+ public Resource(Dispatch dispatch, ResourceRequest rreq, HttpServletRequestWrapper
dreq, ServletContext servletContext)
{
super(dispatch, rreq, dreq, servletContext);
}
@@ -739,7 +799,7 @@
public static abstract class Mime extends DispatchedHttpServletRequest
{
- public Mime(Dispatch dispatch, PortletRequestImpl preq, HttpServletRequest dreq,
ServletContext servletContext)
+ public Mime(Dispatch dispatch, PortletRequest preq, HttpServletRequestWrapper dreq,
ServletContext servletContext)
{
super(dispatch, preq, dreq, servletContext);
}
@@ -778,9 +838,9 @@
{
/** . */
- private final EventRequestImpl ereq;
+ private final EventRequest ereq;
- public Event(Dispatch dispatch, EventRequestImpl ereq, HttpServletRequest dreq,
ServletContext servletContext)
+ public Event(Dispatch dispatch, EventRequest ereq, HttpServletRequestWrapper dreq,
ServletContext servletContext)
{
super(dispatch, ereq, dreq, servletContext);
@@ -797,7 +857,7 @@
public static final class Render extends Mime
{
- public Render(Dispatch dispatch, RenderRequestImpl rreq, HttpServletRequest dreq,
ServletContext servletContext)
+ public Render(Dispatch dispatch, RenderRequest rreq, HttpServletRequestWrapper
dreq, ServletContext servletContext)
{
super(dispatch, rreq, dreq, servletContext);
}
@@ -807,52 +867,4 @@
return "GET";
}
}
-
- /**
- * Returns the an implementation of
<code>javax.servlet.http.HttpSession</code> that wraps this
- * portlet session and use the specified scope for manipulating attributes. This
session is used
- * during the request dispatch to a servlet.
- *
- * @param scope the scope
- * @return the wrapped session
- */
- private HttpSession getSession(boolean create, int scope)
- {
- if (session == null)
- {
- session = new DispatchedHttpSession[2];
- }
-
- // Dereference an existing session if necessary
- if (session[scope] != null && !session[scope].isValid())
- {
- session[scope] = null;
- }
-
- // If we have a session here we are sure it is valid and ok to return it
- if (session[scope] != null)
- {
- // So we do nothing
- }
- else if (create)
- {
- // For sure we need a session we will obtain a valid one
- PortletSession portletSession = preq.getPortletSession();
- session[scope] = new DispatchedHttpSession(this, portletSession, scope);
- }
- else
- {
- // Here we can try an existing session but it may return null
- PortletSession portletSession = preq.getPortletSession(false);
-
- //
- if (portletSession != null)
- {
- session[scope] = new DispatchedHttpSession(this, portletSession, scope);
- }
- }
-
- //
- return session[scope];
- }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/InlineBundle.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -56,21 +56,21 @@
String title = portletInfo.getMeta().getDefaultMetaValue(MetaInfo.TITLE);
if (title != null)
{
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_TITLE, title});
+ list.add(new Object[]{Constants.JAVAX_PORTLET_TITLE, title});
}
//
String shortTitle =
portletInfo.getMeta().getDefaultMetaValue(MetaInfo.SHORT_TITLE);
if (shortTitle != null)
{
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_SHORT_TITLE, shortTitle});
+ list.add(new Object[]{Constants.JAVAX_PORTLET_SHORT_TITLE, shortTitle});
}
//
String keywords = portletInfo.getMeta().getDefaultMetaValue(MetaInfo.KEYWORDS);
if (keywords != null)
{
- list.add(new Object[]{APIConstants.JAVAX_PORTLET_KEYWORDS, keywords});
+ list.add(new Object[]{Constants.JAVAX_PORTLET_KEYWORDS, keywords});
}
//
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -40,7 +40,8 @@
import org.jboss.portal.portlet.impl.jsr168.api.ResourceRequestImpl;
import org.jboss.portal.portlet.impl.jsr168.api.ResourceResponseImpl;
import org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl;
-import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletResponseImpl;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
@@ -78,6 +79,7 @@
import javax.portlet.filter.FilterChain;
import javax.portlet.filter.FilterConfig;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Set;
import java.util.List;
@@ -417,28 +419,61 @@
public PortletInvocationResponse dispatch(PortletInvocation invocation) throws
PortletInvokerException, InvocationException
{
+ HttpServletRequest dreq = invocation.getDispatchedRequest();
+ HttpServletResponse dresp = invocation.getDispatchedResponse();
+
+ //
+ PortletRequestImpl req;
+ PortletResponseImpl resp;
+ String phase;
+ FilterChainImpl<?> chain;
+ if (invocation instanceof ActionInvocation)
+ {
+ req = new ActionRequestImpl((ActionInvocation)invocation);
+ resp = new ActionResponseImpl((ActionInvocation)invocation, req);
+ phase = "ACTION_PHASE";
+ chain = new FilterChainImpl<ActionFilter>(actionFilterList,
ActionFilter.class);
+ }
+ else if (invocation instanceof RenderInvocation)
+ {
+ req = new RenderRequestImpl((RenderInvocation)invocation);
+ resp = new RenderResponseImpl((RenderInvocation)invocation, req);
+ phase = "RENDER_PHASE";
+ chain = new FilterChainImpl<RenderFilter>(renderFilterList,
RenderFilter.class);
+ }
+ else if (invocation instanceof EventInvocation)
+ {
+ req = new EventRequestImpl((EventInvocation)invocation);
+ resp = new EventResponseImpl((EventInvocation)invocation, req);
+ phase = "EVENT_PHASE";
+ chain = new FilterChainImpl<EventFilter>(eventFilterList,
EventFilter.class);
+ }
+ else if (invocation instanceof ResourceInvocation)
+ {
+ req = new ResourceRequestImpl((ResourceInvocation)invocation);
+ resp = new ResourceResponseImpl((ResourceInvocation)invocation, req);
+ phase = "RESOURCE_SERVING_PHASE";
+ chain = new FilterChainImpl<ResourceFilter>(resourceFilterList,
ResourceFilter.class);
+ }
+ else
+ {
+ throw new InvocationException("Unexpected invocation " + invocation);
+ }
+
+ //
try
{
- if (invocation instanceof ActionInvocation)
- {
- return invokeAction((ActionInvocation)invocation);
- }
- else if (invocation instanceof RenderInvocation)
- {
- return invokeRender((RenderInvocation)invocation);
- }
- else if (invocation instanceof EventInvocation)
- {
- return invokeEvent((EventInvocation)invocation);
- }
- else if (invocation instanceof ResourceInvocation)
- {
- return invokeResource((ResourceInvocation)invocation);
- }
- else
- {
- throw new InvocationException("Unexpected invocation " +
invocation);
- }
+ dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_CONFIG, config);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_REQUEST, req);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_RESPONSE, resp);
+ dreq.setAttribute(Constants.JAVAX_PORTLET_LIFECYCLE_PHASE, phase);
+
+ //
+ chain.doFilter(req, resp);
+
+ //
+ return resp.getResponse();
}
catch (NoClassDefFoundError e)
{
@@ -472,135 +507,16 @@
return new ErrorResponse(e);
}
}
- }
-
- protected PortletInvocationResponse invokeAction(ActionInvocation invocation) throws
IOException, PortletException
- {
- PortletAPIFactory factory = application.getPortletAPIFactory();
- ActionRequestImpl req = factory.createActionRequest(invocation);
- ActionResponseImpl resp = factory.createActionResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"ACTION_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
-
- //
- FilterChainImpl<ActionFilter> chain = new
FilterChainImpl<ActionFilter>(actionFilterList, ActionFilter.class);
- chain.doFilter(req, resp);
- }
finally
{
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_CONFIG);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_REQUEST);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_RESPONSE);
+ dreq.removeAttribute(Constants.JAVAX_PORTLET_LIFECYCLE_PHASE);
}
-
- return resp.getResponse();
}
- protected PortletInvocationResponse invokeRender(RenderInvocation invocation) throws
IOException, PortletException
- {
- PortletAPIFactory factory = application.getPortletAPIFactory();
- RenderRequestImpl req = factory.createRenderRequest(invocation);
- RenderResponseImpl resp = factory.createRenderResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"RENDER_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
-
- //
- FilterChainImpl<RenderFilter> chain = new
FilterChainImpl<RenderFilter>(renderFilterList, RenderFilter.class);
- chain.doFilter(req, resp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
-
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
- return resp.getResponse();
- }
-
- protected PortletInvocationResponse invokeEvent(EventInvocation invocation) throws
IOException, PortletException
- {
- // Todo something clever if CCE occues
- EventPortlet eventPortlet = (EventPortlet)portlet;
-
- //
- PortletAPIFactory factory = application.getPortletAPIFactory();
- EventRequestImpl req = factory.createEventRequest(invocation);
- EventResponseImpl resp = factory.createEventResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"EVENT_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
-
- //
- FilterChainImpl<EventFilter> chain = new
FilterChainImpl<EventFilter>(eventFilterList, EventFilter.class);
- chain.doFilter(req, resp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
-
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
- return resp.getResponse();
- }
-
- protected PortletInvocationResponse invokeResource(ResourceInvocation invocation)
throws IOException, PortletException
- {
- // Todo something clever if CCE occues
- ResourceServingPortlet eventPortlet = (ResourceServingPortlet)portlet;
-
- //
- PortletAPIFactory factory = application.getPortletAPIFactory();
- ResourceRequestImpl req = factory.createResourceRequest(invocation);
- ResourceResponseImpl resp = factory.createResourceResponse(invocation, req);
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- try
- {
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_CONFIG, config);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_REQUEST, req);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_RESPONSE, resp);
- dreq.setAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE,
"RESOURCE_SERVING_PHASE");
- dreq.setAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION,
invocation);
-
- //
- FilterChainImpl<ResourceFilter> chain = new
FilterChainImpl<ResourceFilter>(resourceFilterList, ResourceFilter.class);
- chain.doFilter(req, resp);
- }
- finally
- {
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_CONFIG);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_REQUEST);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_RESPONSE);
- dreq.removeAttribute(APIConstants.JAVAX_PORTLET_LIFECYCLE_PHASE);
-
dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
- }
-
- //
- return resp.getResponse();
- }
-
private class Invoker implements ActionFilter, EventFilter, RenderFilter,
ResourceFilter
{
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletRequestAttributes.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -28,7 +28,7 @@
import org.jboss.portal.portlet.container.PortletContainer;
import javax.portlet.PortletRequest;
-import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import java.util.Map;
import java.util.Enumeration;
import java.util.Set;
@@ -56,20 +56,29 @@
/** Constant object to mark that a request attribute is removed. */
protected static final Object REMOVED_ATTRIBUTE = new Object();
- private PortletContainer container;
+ /** . */
+ private final PortletContainer container;
- private UserContext userContext;
+ /** . */
+ private final UserContext userContext;
+ /** . */
+ private final HttpServletRequestWrapper wreq;
+
/** The lazy request attributes map added or removed during the request of the
portlet. */
private Map<String, Object> attributes;
- public PortletRequestAttributes(PortletContainer container, UserContext userContext)
+ public PortletRequestAttributes(
+ PortletContainer container,
+ UserContext userContext,
+ HttpServletRequestWrapper wreq)
{
this.container = container;
this.userContext = userContext;
+ this.wreq = wreq;
}
- public Object getAttribute(String name, HttpServletRequest req)
+ public Object getAttribute(String name)
{
if (name == null)
{
@@ -107,9 +116,9 @@
{
value = attributes.get(name);
}
- if (value == null && req != null)
+ if (value == null && wreq != null)
{
- value = req.getAttribute(name);
+ value = wreq.getAttribute(name);
}
else if (value == REMOVED_ATTRIBUTE)
{
@@ -119,7 +128,7 @@
}
}
- public Iterator<String> getAttributeNames(HttpServletRequest req)
+ public Iterator<String> getAttributeNames()
{
// Copy the attribute names to avoid ConcurrentModificationException
// one test in the TCK getPortalObjectContext the Enumeration then dispatch the
call to a
@@ -127,13 +136,10 @@
Set<String> names = new HashSet<String>();
//
- if (req != null)
+ for (Enumeration e = wreq.getAttributeNames();e.hasMoreElements();)
{
- for (Enumeration e = req.getAttributeNames();e.hasMoreElements();)
- {
- // Fixme : when migrated to servlet 2.5
- names.add((String)e.nextElement());
- }
+ // Fixme : when migrated to servlet 2.5
+ names.add((String)e.nextElement());
}
//
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/RequestDispatcherImpl.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -1,77 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.jsr168;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.ServletException;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class RequestDispatcherImpl implements RequestDispatcher
-{
-
- /** . */
- private final RequestDispatcher realDispatcher;
-
- /** . */
- private final String path;
-
- public RequestDispatcherImpl(RequestDispatcher realDispatcher, String path)
- {
- this.realDispatcher = realDispatcher;
- this.path = path;
- }
-
- public void include(ServletRequest req, ServletResponse resp) throws ServletException,
IOException
- {
- Dispatch dispatch = new Dispatch(DispatchType.INCLUDE, path);
- ((DispatchedHttpServletRequest)req).pushDispatch(dispatch);
- try
- {
- realDispatcher.include(req, resp);
- }
- finally
- {
- ((DispatchedHttpServletRequest)req).popDispatch();
- }
- }
-
- public void forward(ServletRequest req, ServletResponse resp) throws ServletException,
IOException
- {
- Dispatch dispatch = new Dispatch(DispatchType.FORWARD, path);
- ((DispatchedHttpServletRequest)req).pushDispatch(dispatch);
- try
- {
- realDispatcher.forward(req, resp);
- }
- finally
- {
- ((DispatchedHttpServletRequest)req).popDispatch();
- }
- }
-}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/FilterChainImpl.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -37,6 +37,8 @@
import javax.portlet.RenderResponse;
import javax.portlet.EventRequest;
import javax.portlet.EventResponse;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
import java.io.IOException;
import java.util.List;
@@ -63,6 +65,30 @@
this.index = 0;
}
+ public void doFilter(PortletRequest req, PortletResponse resp) throws IOException,
PortletException
+ {
+ if (req instanceof ActionRequest && resp instanceof ActionResponse)
+ {
+ doFilter((ActionRequest)req, (ActionResponse)resp);
+ }
+ else if (req instanceof EventRequest && resp instanceof EventResponse)
+ {
+ doFilter((EventRequest)req, (EventResponse)resp);
+ }
+ else if (req instanceof RenderRequest && resp instanceof RenderResponse)
+ {
+ doFilter((RenderRequest)req, (RenderResponse)resp);
+ }
+ else if (req instanceof ResourceRequest && resp instanceof
ResourceResponse)
+ {
+ doFilter((ResourceRequest)req, (ResourceResponse)resp);
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
public void doFilter(ActionRequest req, ActionResponse resp) throws IOException,
PortletException
{
if (!ActionFilter.class.isAssignableFrom(phase))
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestDispatcherImpl.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
-import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletRequest;
import org.jboss.portal.portlet.impl.jsr168.DispatchedHttpServletResponse;
import org.jboss.portal.portlet.impl.jsr168.DispatchType;
@@ -39,11 +37,14 @@
import javax.portlet.PortletResponse;
import javax.portlet.ActionRequest;
import javax.portlet.EventRequest;
+import javax.portlet.ResourceRequest;
+import javax.portlet.filter.PortletRequestWrapper;
+import javax.portlet.filter.PortletResponseWrapper;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponseWrapper;
import java.io.IOException;
/**
@@ -88,48 +89,48 @@
private void dispatch(
DispatchType type,
- PortletRequest req,
- PortletResponse resp) throws PortletException, IOException
+ PortletRequest wreq,
+ PortletResponse wresp) throws PortletException, IOException
{
+ PortletRequestImpl req = unwrap(wreq);
+ PortletResponseImpl resp = unwrap(wresp);
+
+ //
Dispatch dispatch = new Dispatch(type, path);
//
try
{
- // Get the invocation that is still in the request
- PortletInvocation invocation =
(PortletInvocation)req.getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
-
- //
- PortletApplication application =
((PortletRequestImpl)req).container.getApplication();
+ PortletApplication application = req.container.getApplication();
PortletApplicationContext applicationContext = application.getContext();
ServletContext servletContext = applicationContext.getServletContext();
//
- HttpServletRequest dreq = invocation.getDispatchedRequest();
- HttpServletResponse dresp = invocation.getDispatchedResponse();
+ HttpServletRequestWrapper realReq = req.getRealRequest();
+ HttpServletResponseWrapper realResp = resp.getRealResponse();
//
DispatchedHttpServletRequest direq;
DispatchedHttpServletResponse diresp;
if (req instanceof ActionRequest)
{
- direq = new DispatchedHttpServletRequest.Action(dispatch,
(ActionRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.StateAware(direq,
(StateAwareResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Action(dispatch, (ActionRequest)req,
realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.StateAware(direq,
(StateAwareResponseImpl)resp, realResp);
}
else if (req instanceof EventRequest)
{
- direq = new DispatchedHttpServletRequest.Event(dispatch,
(EventRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.StateAware(direq,
(StateAwareResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Event(dispatch, (EventRequest)req,
realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.StateAware(direq,
(StateAwareResponseImpl)resp, realResp);
}
else if (req instanceof RenderRequest)
{
- direq = new DispatchedHttpServletRequest.Render(dispatch,
(RenderRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.Mime(direq,
(MimeResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Render(dispatch, (RenderRequest)req,
realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.Mime(direq,
(MimeResponseImpl)resp, realResp);
}
else
{
- direq = new DispatchedHttpServletRequest.Resource(dispatch,
(ResourceRequestImpl)req, dreq, servletContext);
- diresp = new DispatchedHttpServletResponse.Mime(direq,
(MimeResponseImpl)resp, dresp);
+ direq = new DispatchedHttpServletRequest.Resource(dispatch,
(ResourceRequest)req, realReq, servletContext);
+ diresp = new DispatchedHttpServletResponse.Mime(direq,
(MimeResponseImpl)resp, realResp);
}
//
@@ -149,4 +150,44 @@
throw new PortletException(e);
}
}
+
+ private PortletRequestImpl unwrap(PortletRequest wrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof PortletRequestImpl)
+ {
+ return (PortletRequestImpl)wrapped;
+ }
+ else if (wrapped instanceof PortletRequestWrapper)
+ {
+ PortletRequestWrapper wrapper = (PortletRequestWrapper)wrapped;
+ wrapped = wrapper.getRequest();
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+
+ private PortletResponseImpl unwrap(PortletResponse wrapped)
+ {
+ while (true)
+ {
+ if (wrapped instanceof PortletResponseImpl)
+ {
+ return (PortletResponseImpl)wrapped;
+ }
+ else if (wrapped instanceof PortletResponseWrapper)
+ {
+ PortletResponseWrapper wrapper = (PortletResponseWrapper)wrapped;
+ wrapped = wrapper.getResponse();
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletRequestImpl.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -56,9 +56,9 @@
import javax.portlet.PreferencesValidator;
import javax.portlet.RenderRequest;
import javax.portlet.WindowState;
-import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequestWrapper;
import java.security.Principal;
import java.util.Collections;
import java.util.Enumeration;
@@ -81,18 +81,43 @@
/** . */
protected static final Logger log = Logger.getLogger(PortletRequestImpl.class);
+ /** . */
protected PortletInvocation invocation;
+
+ /** . */
protected ClientContext clientContext;
+
+ /** . */
protected UserContext userContext;
+
+ /** . */
protected SecurityContext securityContext;
+
+ /** . */
protected ServerContext serverContext;
+
+ /** . */
protected WindowContext windowContext;
+
+ /** . */
protected PortletPreferences preferences;
+
+ /** . */
protected PortletContainerImpl container;
- protected HttpServletRequest dreq;
+
+ /** . */
+ private HttpServletRequestWrapper realReq;
+
+ /** . */
protected PortalContext portalContext;
+
+ /** . */
protected PortletSessionImpl psession;
+
+ /** . */
protected int sessionStatus;
+
+ /** . */
protected ContainerNavigationInfo navigationInfo;
/** . */
@@ -110,6 +135,9 @@
/** . */
protected final Set<org.jboss.portal.WindowState> supportedWindowStates;
+ /** . */
+ private final String contextPath;
+
public PortletRequestImpl(PortletInvocation invocation)
{
PortletContainerImpl container =
(PortletContainerImpl)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE,
PortletContainerInvoker.PORTLET_CONTAINER);
@@ -122,6 +150,7 @@
UserContext userContext = invocation.getUserContext();
//
+ this.contextPath =
(String)invocation.getDispatchedRequest().getAttribute("javax.servlet.include.context_path");
this.invocation = invocation;
this.userContext = userContext;
this.securityContext = invocation.getSecurityContext();
@@ -129,9 +158,9 @@
this.clientContext = invocation.getClientContext();
this.windowContext = invocation.getWindowContext();
this.container = container;
- this.dreq = invocation.getDispatchedRequest();
+ this.realReq = new HttpServletRequestWrapper(invocation.getDispatchedRequest());
this.portalContext = new PortalContextImpl(invocation.getPortalContext());
- this.attributes = new PortletRequestAttributes(container, userContext);
+ this.attributes = new PortletRequestAttributes(container, userContext, realReq);
this.preferences = new PortletPreferencesImpl(prefs, containerPrefs, validator,
mode);
this.navigationInfo = navigationInfo;
this.requestParameterMap = PortletRequestParameterMap.create(navigationInfo,
invocation.getContext());
@@ -145,7 +174,7 @@
{
if (name == null)
{
- throw new IllegalArgumentException("Name shoudl not be null");
+ throw new IllegalArgumentException("Name should not be null");
}
//
@@ -206,15 +235,14 @@
// PLT.11.1.3
-
public Object getAttribute(String name) throws IllegalArgumentException
{
- return attributes.getAttribute(name, dreq);
+ return attributes.getAttribute(name);
}
public Enumeration<String> getAttributeNames()
{
- return Tools.toEnumeration(attributes.getAttributeNames(dreq));
+ return Tools.toEnumeration(attributes.getAttributeNames());
}
public void setAttribute(String name, Object value)
@@ -273,7 +301,7 @@
public String getContextPath()
{
- return (String)dreq.getAttribute("javax.servlet.include.context_path");
+ return contextPath;
}
// PLT.11.1.6
@@ -392,14 +420,14 @@
else if (create)
{
// For sure we need a session we will obtain a valid one
- HttpSession hsession = dreq.getSession();
+ HttpSession hsession = realReq.getSession();
PortletApplicationImpl portletApp =
(PortletApplicationImpl)container.getApplication();
psession = new PortletSessionImpl(hsession, windowContext.getId(),
portletApp.getPortletContext());
}
else
{
// Here we can try an existing session but it may return null
- HttpSession hsession = dreq.getSession(false);
+ HttpSession hsession = realReq.getSession(false);
//
if (hsession != null)
@@ -420,12 +448,12 @@
public String getRequestedSessionId()
{
- return dreq.getRequestedSessionId();
+ return realReq.getRequestedSessionId();
}
public boolean isRequestedSessionIdValid()
{
- return dreq.isRequestedSessionIdValid();
+ return realReq.isRequestedSessionIdValid();
}
public Enumeration<Locale> getLocales()
@@ -510,6 +538,11 @@
}
}
+ public final HttpServletRequestWrapper getRealRequest()
+ {
+ return realReq;
+ }
+
private MultiValuedPropertyMap<String> getProperties()
{
if (properties == null)
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2008-02-03
11:59:52 UTC (rev 9720)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletResponseImpl.java 2008-02-03
16:12:29 UTC (rev 9721)
@@ -32,6 +32,7 @@
import javax.portlet.PortletResponse;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponseWrapper;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -57,10 +58,14 @@
/** . */
private ResponseProperties properties;
+ /** . */
+ private HttpServletResponseWrapper realResp;
+
protected PortletResponseImpl(PortletInvocation invocation, PortletRequestImpl preq)
{
this.invocation = invocation;
this.preq = preq;
+ this.realResp = new
HttpServletResponseWrapper(invocation.getDispatchedResponse());
}
public abstract PortletInvocationResponse getResponse();
@@ -133,6 +138,11 @@
return namespace;
}
+ public final HttpServletResponseWrapper getRealResponse()
+ {
+ return realResp;
+ }
+
protected final ResponseProperties getProperties()
{
return getProperties(true);