You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bridges-commits@portals.apache.org by at...@apache.org on 2011/03/08 02:38:46 UTC
svn commit: r1079076 -
/portals/bridges/bridges-common/trunk/src/main/java/org/apache/portals/bridges/util/ServletPortletSessionProxy.java
Author: ate
Date: Tue Mar 8 01:38:45 2011
New Revision: 1079076
URL: http://svn.apache.org/viewvc?rev=1079076&view=rev
Log:
PB-87: javadoc for ServletPortletSessionProxy
- contributed by Antony Stubbs
Modified:
portals/bridges/bridges-common/trunk/src/main/java/org/apache/portals/bridges/util/ServletPortletSessionProxy.java
Modified: portals/bridges/bridges-common/trunk/src/main/java/org/apache/portals/bridges/util/ServletPortletSessionProxy.java
URL: http://svn.apache.org/viewvc/portals/bridges/bridges-common/trunk/src/main/java/org/apache/portals/bridges/util/ServletPortletSessionProxy.java?rev=1079076&r1=1079075&r2=1079076&view=diff
==============================================================================
--- portals/bridges/bridges-common/trunk/src/main/java/org/apache/portals/bridges/util/ServletPortletSessionProxy.java (original)
+++ portals/bridges/bridges-common/trunk/src/main/java/org/apache/portals/bridges/util/ServletPortletSessionProxy.java Tue Mar 8 01:38:45 2011
@@ -29,16 +29,23 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpSession;
/**
- * Proxy for a Servlet HttpSession to attach to a PortletSession, providing only access to PORTLET_SCOPE session attributes
- * and hiding the APPLICATION_SCOPE attributes from the Servlet.
- * <br/>
- * This Proxy can be used to isolate two instances of the same Portlet dispatching to Servlets so they don't overwrite or read
- * each others session attributes.
- * <br/>
- * Caveat: APPLICATION_SCOPE sessions attributes cannot be used anymore (directly) for inter-portlet communication,
- * or when using Servlets directly which also need to "attach" to the PORTLET_SCOPE session attributes.<br/>
- * The {@link PortletWindowUtils} class can help out with that though.
-
+ * Proxy for a Servlet HttpSession to attach to a PortletSession, providing only access to
+ * PORTLET_SCOPE session attributes and hiding the APPLICATION_SCOPE attributes from the Servlet.
+ *
+ * <p>
+ * This Proxy can be used to isolate two instances of the same Portlet dispatching to Servlets so
+ * they don't overwrite or read each others session attributes.
+ *
+ * <p>
+ * Caveat: APPLICATION_SCOPE sessions attributes cannot be used anymore (directly) for inter-portlet
+ * communication, or when using Servlets directly which also need to "attach" to the PORTLET_SCOPE
+ * session attributes.<br/>
+ * The {@link PortletWindowUtils} class can help out with that though.
+ *
+ * <p>
+ * Note that this is not strictly required with the Portal 2.0 spec, however because Portal Session
+ * Isolation is an optional container feature, this proxy is still very useful.
+ *
* @see PortletWindowUtils
* @author <a href="mailto:ate@douma.nu">Ate Douma</a>
* @version $Id$
@@ -49,6 +56,14 @@ public class ServletPortletSessionProxy
HttpSession servletSession;
String portletWindowPrefix;
+ /**
+ * Constructor which will attempt to discover the portlet window id to use as the portlet name
+ * space and delegate construction to
+ * {@link ServletPortletSessionProxy#createProxy(HttpServletRequest, String)}.
+ *
+ * @param request
+ * @return
+ */
public static HttpSession createProxy(HttpServletRequest request)
{
HttpSession servletSession = request.getSession();
@@ -61,6 +76,15 @@ public class ServletPortletSessionProxy
return servletSession;
}
+ /**
+ * Sets up the session proxy using the name space passed in <code>portletWindowNamespace</code>,
+ * which is typically the portlet window id.
+ *
+ * @param request
+ * @param portletWindowNamespace
+ * the portlet's namespace, typically the portlet's window id.
+ * @return the proxied {@link HttpSession}
+ */
public static HttpSession createProxy(HttpServletRequest request, String portletWindowNamespace)
{
HttpSession servletSession = request.getSession();
@@ -95,12 +119,13 @@ public class ServletPortletSessionProxy
this.portletWindowPrefix = portletWindowPrefix;
}
- /**
- * (non-Javadoc)
- *
- * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
- * java.lang.reflect.Method, java.lang.Object[])
- */
+ /**
+ * Main proxy method, used to proxy calls to attribute related methods from {@link HttpSession}
+ * by prefixing the attribute names with the portlet window id.
+ *
+ * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method,
+ * java.lang.Object[])
+ */
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable
{
Object retval = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: bridges-commits-unsubscribe@portals.apache.org
For additional commands, e-mail: bridges-commits-help@portals.apache.org