[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...

Gavin King gavin.king at jboss.com
Tue Jun 5 20:37:26 EDT 2007


  User: gavin   
  Date: 07/06/05 20:37:26

  Modified:    src/main/org/jboss/seam/core   Pages.java
                        ServletSession.java
  Log:
  JBSEAM-1361
  
  Revision  Changes    Path
  1.127     +2 -17     jboss-seam/src/main/org/jboss/seam/core/Pages.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Pages.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Pages.java,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -b -r1.126 -r1.127
  --- Pages.java	3 Jun 2007 23:02:25 -0000	1.126
  +++ Pages.java	6 Jun 2007 00:37:26 -0000	1.127
  @@ -81,7 +81,6 @@
      private String loginViewId;
      private Map<String, ConversationIdParameter> conversations = Collections.synchronizedMap( new HashMap<String, ConversationIdParameter>() );
      
  -   private boolean invalidateSessionBeforeSchemeChange = true;   
      private Integer httpPort;
      private Integer httpsPort;
      
  @@ -267,10 +266,6 @@
            if ( scheme!=null && !requestScheme.equals(scheme) )
            {
               Manager.instance().redirect(viewId);
  -            if (invalidateSessionBeforeSchemeChange)
  -            {
  -               ServletSession.instance().invalidate();
  -            }
               return false;
            }
         }
  @@ -404,7 +399,7 @@
               !Identity.instance().isLoggedIn();
      }
      
  -   private static String getRequestScheme(FacesContext facesContext)
  +   public static String getRequestScheme(FacesContext facesContext)
      {
         String requestUrl = getRequestUrl(facesContext);
         if (requestUrl==null)
  @@ -1433,16 +1428,6 @@
         this.httpsPort = httpsPort;
      }
      
  -   public boolean isInvalidateSessionBeforeSchemeChange()
  -   {
  -      return invalidateSessionBeforeSchemeChange;
  -   }
  -   
  -   public void setInvalidateSessionBeforeSchemeChange(boolean invalidateSessionBeforeSchemeChange)
  -   {
  -      this.invalidateSessionBeforeSchemeChange = invalidateSessionBeforeSchemeChange;
  -   }
  -   
      public String[] getResources()
      {
         return resources;
  
  
  
  1.2       +47 -3     jboss-seam/src/main/org/jboss/seam/core/ServletSession.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ServletSession.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/ServletSession.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ServletSession.java	3 Jun 2007 23:02:25 -0000	1.1
  +++ ServletSession.java	6 Jun 2007 00:37:26 -0000	1.2
  @@ -1,5 +1,7 @@
   package org.jboss.seam.core;
   
  +import javax.faces.context.FacesContext;
  +
   import org.jboss.seam.Component;
   import org.jboss.seam.InterceptionType;
   import org.jboss.seam.ScopeType;
  @@ -8,12 +10,14 @@
   import org.jboss.seam.annotations.Scope;
   import org.jboss.seam.contexts.Contexts;
   
  - at Scope(ScopeType.EVENT)
  + at Scope(ScopeType.SESSION)
   @Name("org.jboss.seam.core.servletSession")
   @Intercept(InterceptionType.NEVER)
  -public class ServletSession
  +public class ServletSession extends AbstractMutable
   {
      private boolean isInvalid;
  +   private boolean invalidateOnSchemeChange;
  +   private String currentScheme;
   
      public boolean isInvalid()
      {
  @@ -25,6 +29,46 @@
         this.isInvalid = true;
      }
   
  +   public boolean isInvalidDueToNewScheme()
  +   {
  +      if (invalidateOnSchemeChange)
  +      {
  +         FacesContext facesContext = FacesContext.getCurrentInstance();
  +         String requestScheme = Pages.getRequestScheme(facesContext);
  +         if ( currentScheme==null )
  +         {
  +            currentScheme = requestScheme;
  +            setDirty();
  +            return false;
  +         }
  +         else if ( !currentScheme.equals(requestScheme) )
  +         {
  +            currentScheme = requestScheme;
  +            setDirty();
  +            return true;
  +         }
  +         else
  +         {
  +            return false;
  +         }
  +      }
  +      else
  +      {
  +         return false;
  +      }
  +   }
  +
  +   public boolean isInvalidateOnSchemeChange()
  +   {
  +      return invalidateOnSchemeChange;
  +   }
  +
  +   public void setInvalidateOnSchemeChange(boolean invalidateOnSchemeChange)
  +   {
  +      setDirty();
  +      this.invalidateOnSchemeChange = invalidateOnSchemeChange;
  +   }
  +   
      public static ServletSession instance()
      {
         if ( !Contexts.isEventContextActive() )
  
  
  



More information about the jboss-cvs-commits mailing list