You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2018/05/08 12:48:24 UTC

[myfaces] 21/28: MYFACES-3645 review/refactor/document ViewState handling (step 3 and final for now, remove ProjectStage condition and use only one SerializedViewKey in each strategy used (counter --> IntIntSerializedViewKey, random --> IntByteArraySerializedViewKey). In this way, we can avoid different behaviors in development stage and production stage and with the custom SerializedViewKey, we can ensure the minimal possible size of the key in session (each reference counts as an unused slot), viewId has [...]

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 2.1.x-client-window
in repository https://gitbox.apache.org/repos/asf/myfaces.git

commit 243192669c934bae6c082d87f0b909d058c4ba7b
Author: Leonardo Uribe <lu...@apache.org>
AuthorDate: Fri Nov 16 17:19:51 2012 +0000

    MYFACES-3645 review/refactor/document ViewState handling (step 3 and final for now, remove ProjectStage condition and use only one SerializedViewKey in each strategy used (counter --> IntIntSerializedViewKey, random --> IntByteArraySerializedViewKey). In this way, we can avoid different behaviors in development stage and production stage and with the custom SerializedViewKey, we can ensure the minimal possible size of the key in session (each reference counts as an unused slot), viewI [...]
---
 .../viewstate/CounterSessionViewStorageFactory.java            | 10 +---------
 .../application/viewstate/RandomSessionViewStorageFactory.java | 10 +---------
 .../application/viewstate/ServerSideStateCacheImpl.java        | 10 +---------
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/application/viewstate/CounterSessionViewStorageFactory.java b/impl/src/main/java/org/apache/myfaces/application/viewstate/CounterSessionViewStorageFactory.java
index 6eb3e91..291be80 100644
--- a/impl/src/main/java/org/apache/myfaces/application/viewstate/CounterSessionViewStorageFactory.java
+++ b/impl/src/main/java/org/apache/myfaces/application/viewstate/CounterSessionViewStorageFactory.java
@@ -18,7 +18,6 @@
  */
 package org.apache.myfaces.application.viewstate;
 
-import javax.faces.application.ProjectStage;
 import javax.faces.context.FacesContext;
 
 /**
@@ -43,14 +42,7 @@ class CounterSessionViewStorageFactory extends SessionViewStorageFactory
     @Override
     public SerializedViewKey createSerializedViewKey(FacesContext context, String viewId, Integer key)
     {
-        if (context.isProjectStage(ProjectStage.Production))
-        {
-            return new IntIntSerializedViewKey(viewId == null ? 0 : viewId.hashCode(), key);
-        }
-        else
-        {
-            return new ReferenceSerializedViewKey(viewId, key);
-        }
+        return new IntIntSerializedViewKey(viewId == null ? 0 : viewId.hashCode(), key);
     }
     
 }
diff --git a/impl/src/main/java/org/apache/myfaces/application/viewstate/RandomSessionViewStorageFactory.java b/impl/src/main/java/org/apache/myfaces/application/viewstate/RandomSessionViewStorageFactory.java
index 9fd129e..dc5340f 100644
--- a/impl/src/main/java/org/apache/myfaces/application/viewstate/RandomSessionViewStorageFactory.java
+++ b/impl/src/main/java/org/apache/myfaces/application/viewstate/RandomSessionViewStorageFactory.java
@@ -18,7 +18,6 @@
  */
 package org.apache.myfaces.application.viewstate;
 
-import javax.faces.application.ProjectStage;
 import javax.faces.context.FacesContext;
 
 /**
@@ -43,14 +42,7 @@ class RandomSessionViewStorageFactory extends SessionViewStorageFactory
     @Override
     public SerializedViewKey createSerializedViewKey(FacesContext context, String viewId, byte[] key)
     {
-        if (context.isProjectStage(ProjectStage.Production))
-        {
-            return new IntByteArraySerializedViewKey(viewId == null ? 0 : viewId.hashCode(), key);
-        }
-        else
-        {
-            return new ReferenceSerializedViewKey(viewId, key);
-        }
+        return new IntByteArraySerializedViewKey(viewId == null ? 0 : viewId.hashCode(), key);
     }
     
 }
diff --git a/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java b/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
index 46111fc..0cc28b6 100644
--- a/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
@@ -46,7 +46,7 @@ import org.apache.myfaces.shared.util.WebConfigParamUtils;
 
 class ServerSideStateCacheImpl extends StateCache<Object, Object>
 {
-    public static final Logger log = Logger.getLogger(ServerSideStateCacheImpl.class.getName());
+    private static final Logger log = Logger.getLogger(ServerSideStateCacheImpl.class.getName());
     
     public static final String SERIALIZED_VIEW_SESSION_ATTR= 
         ServerSideStateCacheImpl.class.getName() + ".SERIALIZED_VIEW";
@@ -224,17 +224,12 @@ class ServerSideStateCacheImpl extends StateCache<Object, Object>
     
     public static final int UNCOMPRESSED_FLAG = 0;
     public static final int COMPRESSED_FLAG = 1;
-    
-    public static final Object[] EMPTY_STATES = new Object[]{null, null};
 
-    //private static final int JSF_SEQUENCE_INDEX = 0;
-    
     private Boolean _useFlashScopePurgeViewsInSession = null;
     
     private Integer _numberOfSequentialViewsInSession = null;
     private boolean _numberOfSequentialViewsInSessionSet = false;
 
-    //private final KeyFactory keyFactory;
     private SessionViewStorageFactory sessionViewStorageFactory;
 
     public ServerSideStateCacheImpl()
@@ -245,19 +240,16 @@ class ServerSideStateCacheImpl extends StateCache<Object, Object>
                 RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_PARAM_DEFAULT);
         if (RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_SECURE_RANDOM.equals(randomMode))
         {
-            //keyFactory = new SecureRandomKeyFactory(facesContext);
             sessionViewStorageFactory = new RandomSessionViewStorageFactory(
                     new SecureRandomKeyFactory(facesContext));
         }
         else if (RANDOM_KEY_IN_VIEW_STATE_SESSION_TOKEN_RANDOM.equals(randomMode))
         {
-            //keyFactory = new RandomKeyFactory(facesContext);
             sessionViewStorageFactory = new RandomSessionViewStorageFactory(
                     new RandomKeyFactory(facesContext));
         }
         else
         {
-            //keyFactory = new CounterKeyFactory();
             sessionViewStorageFactory = new CounterSessionViewStorageFactory(new CounterKeyFactory());
         }
     }

-- 
To stop receiving notification emails like this one, please contact
deki@apache.org.