myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sobr...@apache.org
Subject svn commit: r634476 - in /myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload: ActionUploadRequestWrapper.java FileUploadConfiguratorImpl.java
Date Fri, 07 Mar 2008 00:21:07 GMT
Author: sobryan
Date: Thu Mar  6 16:21:05 2008
New Revision: 634476

URL: http://svn.apache.org/viewvc?rev=634476&view=rev
Log:
TRINIDAD-995: FileUpload sets render parameters in portal

* Removed the call to setRenderParameter
* Added a Portlet Bridge annotation to the "applied flag"
  that will not be preserved between requests.  This will
  be needed for ResourceRequest's..

Modified:
    myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/ActionUploadRequestWrapper.java
    myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java

Modified: myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/ActionUploadRequestWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/ActionUploadRequestWrapper.java?rev=634476&r1=634475&r2=634476&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/ActionUploadRequestWrapper.java
(original)
+++ myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/ActionUploadRequestWrapper.java
Thu Mar  6 16:21:05 2008
@@ -51,9 +51,6 @@
     _extractedParams.putAll(params);
 
     _encoding = super.getCharacterEncoding();
-
-    //add these params to the render request
-    _response.setRenderParameters(_extractedParams);
   }
 
   /**

Modified: myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java?rev=634476&r1=634475&r2=634476&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java
(original)
+++ myfaces/trinidad/branches/1.2.6.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/config/upload/FileUploadConfiguratorImpl.java
Thu Mar  6 16:21:05 2008
@@ -25,6 +25,9 @@
 import java.util.Map;
 
 import javax.faces.context.ExternalContext;
+
+import javax.portlet.faces.annotation.ExcludeFromManagedRequestScope;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.myfaces.trinidad.config.Configurator;
@@ -74,7 +77,7 @@
   @SuppressWarnings("unchecked")
   static public void apply(ExternalContext context)
   {
-    context.getRequestMap().put(_APPLIED, Boolean.TRUE);
+    context.getRequestMap().put(_APPLIED, AppliedClass.APPLIED);
   }
 
   /* (non-Javadoc)
@@ -207,6 +210,8 @@
   {
     if(!isApplied(externalContext))
     {
+      //TODO: For JSR-286, we'll also need to handle ResourceRequest
+      //      so that FileUploads in a PPR will work correctly.
       if(!ExternalContextUtils.isPortlet(externalContext))
       {  
         externalContext.setRequest(new UploadRequestWrapper(
@@ -215,12 +220,12 @@
       }
       else if(ExternalContextUtils.isAction(externalContext))
       {
-        /*
-         * We only need to do this if we have an action request.  Why?
-         * Because durring the ActionRequest, the wrapper will set the
-         * RenderParameters.  This is a cool thing because subsequent
-         * render requests will retain these parameters for us.
-         */
+        // We do not need to worry about render request.  According to 
+        // "Portlet 1.0 Bridge Specification for JavaServer Faces 1.2"
+        // section 3.2, parameters are not preserved between action and
+        // render.  IF the preserveActionParameters setting is set, the
+        // current R.I. pulls these off of the external context.  So
+        // making sure that they are set correctly here should be sufficient.
         externalContext.setRequest(new ActionUploadRequestWrapper(externalContext,
            addedParams));
       }
@@ -276,5 +281,13 @@
   static private final String _APPLIED = FileUploadConfiguratorImpl.class.getName()+".APPLIED";
   static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(FileUploadConfiguratorImpl.class);
   static private final String _PARAMS = FileUploadConfiguratorImpl.class.getName()+".PARAMS";
+  
   private long _maxAllowedBytes = 1L << 27;
+  
+  //This class will disappear between phases of the Request in a portlet environment
+  @ExcludeFromManagedRequestScope
+  private static class AppliedClass
+  {
+    public static final AppliedClass APPLIED = new AppliedClass();
+  }
 }



Mime
View raw message