myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r690274 - /myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Date Fri, 29 Aug 2008 14:38:11 GMT
Author: matzew
Date: Fri Aug 29 07:38:10 2008
New Revision: 690274

URL: http://svn.apache.org/viewvc?rev=690274&view=rev
Log:
TRINIDAD-943 - handle session timeout

added getRequestedSessionId() and isRequestedSessionIdValid() to ExternalContextUtils, since
JSF 1.x API is to poor for that.
These funcs will be used in the configurator, to handle the redirect on timeout.

Modified:
    myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java

Modified: myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java?rev=690274&r1=690273&r2=690274&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
(original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/ExternalContextUtils.java
Fri Aug 29 07:38:10 2008
@@ -24,6 +24,7 @@
 import javax.faces.context.ExternalContext;
 import javax.portlet.ActionRequest;
 import javax.portlet.PortletContext;
+import javax.portlet.PortletRequest;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
@@ -40,6 +41,42 @@
 {
 
   /**
+   * Returns the session ID for the client, or null if there is none.
+   *
+   * @param externalContext
+   * @return
+   */
+  public static String getRequestedSessionId(final ExternalContext externalContext)
+  {
+    if (isPortlet(externalContext))
+    {
+      return ((PortletRequest) externalContext.getRequest()).getRequestedSessionId();
+    }
+    else
+    {
+      return ((HttpServletRequest) externalContext.getRequest()).getRequestedSessionId();
+    }
+  }
+
+  /**
+   * Checks if the requested session ID is still valid
+   *
+   * @param externalContext
+   * @return
+   */
+  public static boolean isRequestedSessionIdValid(final ExternalContext externalContext)
+  {
+    if (isPortlet(externalContext))
+    {
+      return ((PortletRequest) externalContext.getRequest()).isRequestedSessionIdValid();
+    }
+    else
+    {
+      return ((HttpServletRequest) externalContext.getRequest()).isRequestedSessionIdValid();
+    }
+  }
+
+  /**
    * Returns the contextPath of the ServletContext or null for portlets
    *
    * @param externalContext



Mime
View raw message