myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1760820 - in /myfaces/trinidad/trunk: ./ trinidad-impl/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ trinidad-impl/src/main/java/org/a...
Date Thu, 15 Sep 2016 01:42:59 GMT
Author: lu4242
Date: Thu Sep 15 01:42:58 2016
New Revision: 1760820

URL: http://svn.apache.org/viewvc?rev=1760820&view=rev
Log:
Standardize state saving

Added:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassLoaderUtils.java
      - copied, changed from r1751953, myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassUtils.java
      - copied, changed from r1751953, myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassUtils.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/MyFacesObjectInputStream.java
      - copied, changed from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/StateUtils.java
      - copied, changed from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/DefaultSerialFactory.java
      - copied, changed from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/DefaultSerialFactory.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/SerialFactory.java
      - copied, changed from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/SerialFactory.java
Modified:
    myfaces/trinidad/trunk/pom.xml
    myfaces/trinidad/trunk/trinidad-impl/pom.xml
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java

Modified: myfaces/trinidad/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/pom.xml?rev=1760820&r1=1760819&r2=1760820&view=diff
==============================================================================
--- myfaces/trinidad/trunk/pom.xml (original)
+++ myfaces/trinidad/trunk/pom.xml Thu Sep 15 01:42:58 2016
@@ -72,6 +72,8 @@ Create A Branch (http://maven.apache.org
     <portlet-bridge.version>2.0.0</portlet-bridge.version>
     <commons-lang.version>2.4</commons-lang.version>
     <commons-io.version>2.0</commons-io.version>
+	<commons-codec.version>1.3</commons-codec.version>
+
     <pluto-embedded.version>1.0.1</pluto-embedded.version>
     
     <!-- Testing -->
@@ -93,7 +95,7 @@ Create A Branch (http://maven.apache.org
     
     <!-- Other -->
     <jdev.release>11.1.1.0.0</jdev.release>
-    <myfaces-builder-annotations.version>1.0.8</myfaces-builder-annotations.version>
+    <myfaces-builder-annotations.version>1.0.9</myfaces-builder-annotations.version>
 
     <!-- Site deployment -->
     <siteModule.path>trinidad</siteModule.path>
@@ -290,6 +292,12 @@ Create A Branch (http://maven.apache.org
         <artifactId>commons-io</artifactId>
         <version>${commons-io.version}</version>
       </dependency>
+	  
+      <dependency>
+		<groupId>commons-codec</groupId>
+		<artifactId>commons-codec</artifactId>
+		<version>${commons-codec.version}</version>
+	  </dependency>	  
 
       <dependency>
         <groupId>org.apache.myfaces.buildtools</groupId>

Modified: myfaces/trinidad/trunk/trinidad-impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/pom.xml?rev=1760820&r1=1760819&r2=1760820&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/pom.xml (original)
+++ myfaces/trinidad/trunk/trinidad-impl/pom.xml Thu Sep 15 01:42:58 2016
@@ -86,6 +86,12 @@
       <groupId>org.apache.myfaces.trinidad</groupId>
       <artifactId>trinidad-api</artifactId>
     </dependency>
+    
+     <dependency> 	 
+       <groupId>commons-codec</groupId> 	 
+       <artifactId>commons-codec</artifactId>
+       <scope>compile</scope> 	 
+     </dependency>
 
     <!--dependency>
       <groupId>com.sun.facelets</groupId>

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java?rev=1760820&r1=1760819&r2=1760820&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreResponseStateManager.java
Thu Sep 15 01:42:58 2016
@@ -18,20 +18,9 @@
  */
 package org.apache.myfaces.trinidadinternal.renderkit.core;
 
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
 import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OptionalDataException;
-import java.io.StringReader;
-import java.io.StringWriter;
 
 import java.util.Map;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
 
 import javax.faces.FacesException;
 import javax.faces.application.StateManager;
@@ -41,11 +30,8 @@ import javax.faces.context.ResponseWrite
 import javax.faces.render.ResponseStateManager;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidad.util.Base64InputStream;
-import org.apache.myfaces.trinidad.util.Base64OutputStream;
-import org.apache.myfaces.trinidad.util.ClassLoaderUtils;
 import org.apache.myfaces.trinidadinternal.application.StateManagerImpl;
-import org.apache.myfaces.trinidadinternal.util.ObjectInputStreamResolveClass;
+import org.apache.myfaces.trinidadinternal.util.StateUtils;
 
 /**
  * ResponseStateManager implementation for the Core RenderKit.
@@ -94,7 +80,7 @@ public class CoreResponseStateManager ex
     // out twice
     //    rw.writeAttribute("id", VIEW_STATE_PARAM, null);
 
-    String s = encodeSerializedViewAsString(serializedView);
+    String s = encodeSerializedViewAsString(context, serializedView);
     rw.writeAttribute("value", s, null);
 
     rw.endElement("input");
@@ -111,13 +97,16 @@ public class CoreResponseStateManager ex
   }
 
 
-  protected String encodeSerializedViewAsString(
+  protected String encodeSerializedViewAsString(FacesContext context,
     StateManager.SerializedView serializedView) throws IOException
   {
     if ((serializedView.getState() == null) &&
         (serializedView.getStructure() instanceof String))
-      return _TOKEN_PREFIX + serializedView.getStructure();
+      return _TOKEN_PREFIX + StateUtils.construct(serializedView.getStructure(), context.getExternalContext());
 
+    return StateUtils.construct(
+            new Object[]{serializedView.getStructure(),serializedView.getState()}, context.getExternalContext());
   
+    /*
     StringWriter sw = new StringWriter();
     BufferedWriter bw = new BufferedWriter(sw);
     Base64OutputStream b64_out = new Base64OutputStream(bw);
@@ -136,7 +125,7 @@ public class CoreResponseStateManager ex
     String retVal = sw.toString();
 
     assert(!retVal.startsWith(_TOKEN_PREFIX));
-    return retVal;
+    return retVal;*/
   }
 
   @Override
@@ -166,7 +155,7 @@ public class CoreResponseStateManager ex
     StateManager.SerializedView serializedView = _getSerializedView(context, state);
     try
     {
-      return encodeSerializedViewAsString(serializedView);
+      return encodeSerializedViewAsString(context, serializedView);
     }
     catch (IOException e)
     {
@@ -271,13 +260,15 @@ public class CoreResponseStateManager ex
  
       if (tokenString != null)
       {
-        view = new Object[]{tokenString, null};
+        view = new Object[]{StateUtils.reconstruct(tokenString, context.getExternalContext()),
null};
       }
       // Nope, let's look for a regular state field
       else
       {
         if (stateString != null)
         {
+          view = (Object[]) StateUtils.reconstruct(stateString, context.getExternalContext());
+          /*
           StringReader sr = new StringReader(stateString);
           BufferedReader br = new BufferedReader(sr);
           Base64InputStream b64_in = new Base64InputStream(br);
@@ -305,6 +296,7 @@ public class CoreResponseStateManager ex
           {
             _LOG.severe(ioe);
           }
+          */
         }
       }
 

Copied: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassLoaderUtils.java
(from r1751953, myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassLoaderUtils.java?p2=myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassLoaderUtils.java&p1=myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.java&r1=1751953&r2=1760820&rev=1760820&view=diff
==============================================================================
--- myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassLoaderUtils.java
Thu Sep 15 01:42:58 2016
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.shared.util;
+package org.apache.myfaces.trinidadinternal.util;
 
 import java.io.BufferedReader;
 import java.io.InputStream;

Copied: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassUtils.java
(from r1751953, myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassUtils.java?p2=myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassUtils.java&p1=myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassUtils.java&r1=1751953&r2=1760820&rev=1760820&view=diff
==============================================================================
--- myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ClassUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/ClassUtils.java
Thu Sep 15 01:42:58 2016
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.shared.util;
+package org.apache.myfaces.trinidadinternal.util;
 
 import javax.el.ExpressionFactory;
 import javax.faces.FacesException;
@@ -65,7 +65,7 @@ public final class ClassUtils
     public static final Class DOUBLE_OBJECT_ARRAY_CLASS = Double[].class;
     public static final Class STRING_OBJECT_ARRAY_CLASS = String[].class;
 
-    public static ClassLoaderExtension [] classLoadingExtensions = new ClassLoaderExtension[0];
+    //public static ClassLoaderExtension [] classLoadingExtensions = new ClassLoaderExtension[0];
 
 
 
@@ -121,6 +121,7 @@ public final class ClassUtils
 
     //~ Methods ------------------------------------------------------------------------------------
 
+    /*
     public synchronized static void addClassLoadingExtension(ClassLoaderExtension extension,
boolean top)
     {
       /**
@@ -131,6 +132,7 @@ public final class ClassUtils
        * we have to synchronized nevertheless because if two threads try to register
        * loaders at the same time none of them should get lost
        */
+       /*
         ClassLoaderExtension [] retVal = new ClassLoaderExtension[classLoadingExtensions.length+1];
         ArrayList extensions = new ArrayList(classLoadingExtensions.length+1);
 
@@ -145,7 +147,7 @@ public final class ClassUtils
         }    
 
         classLoadingExtensions = (ClassLoaderExtension []) extensions.toArray(retVal);
-    }
+    }*/
 
     /**
      * Tries a Class.loadClass with the context class loader of the current thread first
and
@@ -163,6 +165,7 @@ public final class ClassUtils
         //we now assign the array to safekeep the reference on
         // the local variable stack, that way
         //we can avoid synchronisation calls
+        /*
         ClassLoaderExtension [] loaderPlugins = classLoadingExtensions;
 
         int plugins = loaderPlugins.length;
@@ -175,7 +178,7 @@ public final class ClassUtils
                 return retVal;
             }
         }
-
+        */
 
         if (type == null)
         {

Copied: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/MyFacesObjectInputStream.java
(from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/MyFacesObjectInputStream.java?p2=myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/MyFacesObjectInputStream.java&p1=myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java&r1=1751953&r2=1760820&rev=1760820&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/MyFacesObjectInputStream.java
Thu Sep 15 01:42:58 2016
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.shared.util;
+package org.apache.myfaces.trinidadinternal.util;
 
 import java.io.IOException;
 import java.io.InputStream;

Copied: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/StateUtils.java
(from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/StateUtils.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/StateUtils.java?p2=myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/StateUtils.java&p1=myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/StateUtils.java&r1=1751953&r2=1760820&rev=1760820&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/StateUtils.java
Thu Sep 15 01:42:58 2016
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.shared.util;
+package org.apache.myfaces.trinidadinternal.util;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -47,7 +47,8 @@ import javax.servlet.ServletContext;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
-import org.apache.myfaces.shared.util.serial.SerialFactory;
+import org.apache.myfaces.trinidadinternal.util.serial.DefaultSerialFactory;
+import org.apache.myfaces.trinidadinternal.util.serial.SerialFactory;
 
 /**
  * <p>This Class exposes a handful of methods related to encryption,
@@ -148,8 +149,9 @@ public final class StateUtils
      * by state manager into a byte array. The expected class must implement
      * org.apache.myfaces.shared.util.serial.SerialFactory interface.
      */
-    @JSFWebConfigParam(name="org.apache.myfaces.SERIAL_FACTORY", since="1.1",group="state",tags="performance")
-    public static final String SERIAL_FACTORY = INIT_PREFIX + "SERIAL_FACTORY";
+    //@JSFWebConfigParam(name="org.apache.myfaces.trinidad.SERIAL_FACTORY", 
+    //                   since="1.1",group="state",tags="performance")
+    public static final String SERIAL_FACTORY = INIT_PREFIX + "trinidad.SERIAL_FACTORY";
     
     /**
      * Indicate if the view state should be compressed before encrypted(optional) and encoded
@@ -282,7 +284,9 @@ public final class StateUtils
         
         if(serialFactory == null)
         {
-            throw new NullPointerException("serialFactory");
+            // throw new NullPointerException("serialFactory");
+            serialFactory = new DefaultSerialFactory();
+            ctx.getApplicationMap().put(SERIAL_FACTORY, serialFactory);
         }
         
         try

Copied: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/DefaultSerialFactory.java
(from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/DefaultSerialFactory.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/DefaultSerialFactory.java?p2=myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/DefaultSerialFactory.java&p1=myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/DefaultSerialFactory.java&r1=1751953&r2=1760820&rev=1760820&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/DefaultSerialFactory.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/DefaultSerialFactory.java
Thu Sep 15 01:42:58 2016
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.shared.util.serial;
+package org.apache.myfaces.trinidadinternal.util.serial;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -24,7 +24,7 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 
-import org.apache.myfaces.shared.util.MyFacesObjectInputStream;
+import org.apache.myfaces.trinidadinternal.util.MyFacesObjectInputStream;
 
 public class DefaultSerialFactory implements SerialFactory
 {

Copied: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/SerialFactory.java
(from r1751953, myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/SerialFactory.java)
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/SerialFactory.java?p2=myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/SerialFactory.java&p1=myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/SerialFactory.java&r1=1751953&r2=1760820&rev=1760820&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/util/serial/SerialFactory.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/serial/SerialFactory.java
Thu Sep 15 01:42:58 2016
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.shared.util.serial;
+package org.apache.myfaces.trinidadinternal.util.serial;
 
 import java.io.IOException;
 import java.io.InputStream;



Mime
View raw message