You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2017/09/24 19:54:38 UTC

svn commit: r1809548 - in /myfaces/core/branches/2.3.x: api/ impl-test/ impl/ impl/src/main/java/org/apache/myfaces/application/jsp/ impl/src/test/java/org/apache/myfaces/context/ impl/src/test/java/org/apache/myfaces/view/facelets/mock/ parent/ shared...

Author: tandraschko
Date: Sun Sep 24 19:54:38 2017
New Revision: 1809548

URL: http://svn.apache.org/viewvc?rev=1809548&view=rev
Log:
MYFACES-4155 Updated to Servlet3.1 and fix HttpPartWrapper#getSubmittedFileName 

Modified:
    myfaces/core/branches/2.3.x/api/pom.xml
    myfaces/core/branches/2.3.x/impl-test/pom.xml
    myfaces/core/branches/2.3.x/impl/pom.xml
    myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java
    myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java
    myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java
    myfaces/core/branches/2.3.x/parent/pom.xml
    myfaces/core/branches/2.3.x/shared-public/pom.xml
    myfaces/core/branches/2.3.x/shared/pom.xml
    myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HttpPartWrapper.java
    myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/view/SwitchableOutputStream.java

Modified: myfaces/core/branches/2.3.x/api/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/pom.xml?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/pom.xml (original)
+++ myfaces/core/branches/2.3.x/api/pom.xml Sun Sep 24 19:54:38 2017
@@ -631,10 +631,10 @@
             NOTE that all versions and scopes are defined in the parent dependencyManagement section
             (except for optional=true due to a maven bug). 
         -->
-        <!-- Servlet 3.0 -->
+        <!-- Servlet 3.1 -->
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-servlet-api</artifactId>
         </dependency>
         <!-- JSP 2.1 -->
         <dependency>

Modified: myfaces/core/branches/2.3.x/impl-test/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl-test/pom.xml?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl-test/pom.xml (original)
+++ myfaces/core/branches/2.3.x/impl-test/pom.xml Sun Sep 24 19:54:38 2017
@@ -177,10 +177,10 @@
             <scope>provided</scope>
         </dependency>
         
-        <!-- Servlet 3.0 by default. Use the -Pee5 compile for servlet-2.5 -->
+        <!-- Servlet 3.1 -->
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-servlet-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>

Modified: myfaces/core/branches/2.3.x/impl/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/pom.xml?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/pom.xml (original)
+++ myfaces/core/branches/2.3.x/impl/pom.xml Sun Sep 24 19:54:38 2017
@@ -1140,10 +1140,10 @@
         </dependency>
 
 
-        <!-- Servlet 3.0 by default. Use the -Pee5 compile for servlet-2.5 -->
+        <!-- Servlet 3.1 -->
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-servlet-api</artifactId>
         </dependency>
 
         <!-- JSP 2.1 -->

Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/application/jsp/ServletViewResponseWrapper.java Sun Sep 24 19:54:38 2017
@@ -32,6 +32,7 @@ import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetDecoder;
+import javax.servlet.WriteListener;
 
 /**
  * @author Bruno Aranda (latest modification by $Author$)
@@ -226,6 +227,18 @@ public class ServletViewResponseWrapper
         {
             _byteArrayOutputStream.reset();
         }
+
+        @Override
+        public boolean isReady()
+        {
+            return true;
+        }
+
+        @Override
+        public void setWriteListener(WriteListener wl)
+        {
+            
+        }
         
         /**
          * This Wrapper is used to provide additional methods to 

Modified: myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java Sun Sep 24 19:54:38 2017
@@ -26,6 +26,7 @@ import javax.faces.context.ResponseWrite
 import javax.servlet.ServletOutputStream;
 import javax.servlet.ServletResponse;
 import javax.servlet.ServletResponseWrapper;
+import javax.servlet.WriteListener;
 
 import org.apache.myfaces.context.servlet.FacesContextImpl;
 import org.apache.myfaces.test.base.AbstractJsfTestCase;
@@ -133,6 +134,18 @@ public class ResponseWrapperSwitchTest e
         public void write(int arg0) throws IOException {
             _bos.write(arg0);
         }
+
+        @Override
+        public boolean isReady()
+        {
+            return true;
+        }
+
+        @Override
+        public void setWriteListener(WriteListener wl)
+        {
+
+        }
     }
 
     /**

Modified: myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/test/java/org/apache/myfaces/view/facelets/mock/MockServletInputStream.java Sun Sep 24 19:54:38 2017
@@ -22,8 +22,10 @@ package org.apache.myfaces.view.facelets
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import javax.servlet.ReadListener;
 
 import javax.servlet.ServletInputStream;
+import javax.servlet.WriteListener;
 
 /**
  * 
@@ -45,9 +47,27 @@ public class MockServletInputStream exte
         this.source = source;
     }
 
+    @Override
     public int read() throws IOException
     {
         return this.source.read();
     }
 
+    @Override
+    public boolean isReady()
+    {
+        return true;
+    }
+
+    @Override
+    public boolean isFinished()
+    {
+        return false;
+    }
+
+    @Override
+    public void setReadListener(ReadListener rl)
+    {
+
+    }
 }

Modified: myfaces/core/branches/2.3.x/parent/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/parent/pom.xml?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/parent/pom.xml (original)
+++ myfaces/core/branches/2.3.x/parent/pom.xml Sun Sep 24 19:54:38 2017
@@ -383,11 +383,11 @@
 
             <!-- SPEC DEPENDENCIES -->
 
-            <!-- Servlet 3.0 (for ee6) -->
+            <!-- Servlet 3.1 -->
             <dependency>
-                <groupId>org.apache.geronimo.specs</groupId>
-                <artifactId>geronimo-servlet_3.0_spec</artifactId>
-                <version>1.0</version>
+                <groupId>org.apache.tomcat</groupId>
+                <artifactId>tomcat-servlet-api</artifactId>
+                <version>8.5.21</version>
                 <scope>provided</scope>
             </dependency>
 

Modified: myfaces/core/branches/2.3.x/shared-public/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared-public/pom.xml?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared-public/pom.xml (original)
+++ myfaces/core/branches/2.3.x/shared-public/pom.xml Sun Sep 24 19:54:38 2017
@@ -46,10 +46,10 @@
             <artifactId>myfaces-api</artifactId>
         </dependency>
 
-        <!-- Servlet 3.0 -->
+        <!-- Servlet 3.1 -->
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-servlet-api</artifactId>
         </dependency>
 
         <!-- JSP 2.1 -->

Modified: myfaces/core/branches/2.3.x/shared/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared/pom.xml?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared/pom.xml (original)
+++ myfaces/core/branches/2.3.x/shared/pom.xml Sun Sep 24 19:54:38 2017
@@ -52,10 +52,10 @@
             <optional>true</optional> 
         </dependency>
 
-        <!-- Servlet 3.0 for the fileupload -->
+        <!-- Servlet 3.1 -->
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-servlet-api</artifactId>
         </dependency>
 
         <!-- JSP 2.1 -->

Modified: myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HttpPartWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HttpPartWrapper.java?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HttpPartWrapper.java (original)
+++ myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HttpPartWrapper.java Sun Sep 24 19:54:38 2017
@@ -20,10 +20,7 @@ package org.apache.myfaces.shared.render
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.util.Collection;
-import javax.faces.FacesException;
 import javax.faces.FacesWrapper;
 import javax.faces.component.StateHolder;
 import javax.faces.context.FacesContext;
@@ -96,19 +93,10 @@ public class HttpPartWrapper implements
         getWrapped().write(fileName);
     }
     
+    @Override
     public String getSubmittedFileName()
     {
-        Part wrapped = getWrapped();
-        try
-        {
-            Method m = Part.class.getMethod("getSubmittedFileName");
-            return (String) m.invoke(wrapped);
-        }
-        catch (NoSuchMethodException | SecurityException | IllegalAccessException
-                | IllegalArgumentException | InvocationTargetException ex)
-        {
-            throw new FacesException(ex);
-        }
+        return getWrapped().getSubmittedFileName();
     }
 
     @Override

Modified: myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/view/SwitchableOutputStream.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/view/SwitchableOutputStream.java?rev=1809548&r1=1809547&r2=1809548&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/view/SwitchableOutputStream.java (original)
+++ myfaces/core/branches/2.3.x/shared/src/main/java/org/apache/myfaces/shared/view/SwitchableOutputStream.java Sun Sep 24 19:54:38 2017
@@ -19,9 +19,9 @@
 package org.apache.myfaces.shared.view;
 
 import java.io.IOException;
-import java.io.OutputStream;
 
 import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
 
 /**
  * Delegates the standard OutputStream-methods (close, flush, write)
@@ -30,7 +30,7 @@ import javax.servlet.ServletOutputStream
 class SwitchableOutputStream extends ServletOutputStream
 {
 
-    OutputStream _delegate = null;
+    ServletOutputStream _delegate = null;
     ResponseSwitch _responseSwitch = null;
 
     public SwitchableOutputStream(ServletOutputStream delegate, ResponseSwitch responseSwitch)
@@ -83,5 +83,25 @@ class SwitchableOutputStream extends Ser
             _delegate.write(b);
         }
     }
+
+    @Override
+    public boolean isReady()
+    {
+        if (_responseSwitch.isEnabled())
+        {
+            return _delegate.isReady();
+        }
+        
+        return true;
+    }
+
+    @Override
+    public void setWriteListener(WriteListener wl)
+    {
+        if (_responseSwitch.isEnabled())
+        {
+            _delegate.setWriteListener(wl);
+        }
+    }
     
 }