myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1438775 - in /myfaces/core/branches/2.2.x: api/src/main/java/javax/faces/context/ impl/src/main/java/org/apache/myfaces/context/servlet/
Date Fri, 25 Jan 2013 23:51:25 GMT
Author: lu4242
Date: Fri Jan 25 23:51:25 2013
New Revision: 1438775

URL: http://svn.apache.org/viewvc?rev=1438775&view=rev
Log:
MYFACES-3688 Implement ExternalContext.getSessionId() 

Modified:
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContext.java
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContextWrapper.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContext.java?rev=1438775&r1=1438774&r2=1438775&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContext.java
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContext.java
Fri Jan 25 23:51:25 2013
@@ -738,6 +738,10 @@ public abstract class ExternalContext
         ctx.setSessionMaxInactiveInterval(interval);
     }
 
+    /**
+     * @since 2.2
+     * @return 
+     */
     public ClientWindow getClientWindow()
     {
         ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
@@ -753,6 +757,10 @@ public abstract class ExternalContext
         return ctx.getClientWindow();
     }
     
+    /**
+     * @since 2.2
+     * @param window 
+     */
     public void setClientWindow(ClientWindow window)
     {
         // No op for now.
@@ -767,4 +775,21 @@ public abstract class ExternalContext
         ctx.setClientWindow(window);
         */
     }
+    
+    /**
+     * @since 2.2
+     * @param create
+     * @return 
+     */
+    public String getSessionId(boolean create)
+    {
+        ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
+        
+        if (ctx == null)
+        {
+            throw new UnsupportedOperationException();
+        }
+        
+        return ctx.getSessionId(create);
+    }
 }

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContextWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContextWrapper.java?rev=1438775&r1=1438774&r2=1438775&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContextWrapper.java
(original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/context/ExternalContextWrapper.java
Fri Jan 25 23:51:25 2013
@@ -491,4 +491,9 @@ public abstract class ExternalContextWra
         getWrapped().setClientWindow(window);
     }
     
+    @Override
+    public String getSessionId(boolean create)
+    {
+        return getWrapped().getSessionId(create);
+    }
 }

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java?rev=1438775&r1=1438774&r2=1438775&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
(original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
Fri Jan 25 23:51:25 2013
@@ -147,6 +147,22 @@ public final class ServletExternalContex
         checkHttpServletRequest();
         return ((HttpServletRequest) _servletRequest).getSession(create);
     }
+    
+    @Override
+    public String getSessionId(boolean create)
+    {
+        checkHttpServletRequest();
+        HttpSession session = ((HttpServletRequest) _servletRequest).getSession(create);
+        if (session != null)
+        {
+            return session.getId();
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
 
     @Override
     public Object getRequest()

Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java?rev=1438775&r1=1438774&r2=1438775&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java
(original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/context/servlet/StartupServletExternalContextImpl.java
Fri Jan 25 23:51:25 2013
@@ -184,6 +184,12 @@ public class StartupServletExternalConte
     }
 
     @Override
+    public String getSessionId(boolean create)
+    {
+        throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
+    }
+
+    @Override
     public Map<String, Object> getSessionMap()
     {
         throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());



Mime
View raw message