You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/03/04 22:42:44 UTC

svn commit: r1733657 - in /myfaces/tobago/branches/tobago-3.0.x: tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java

Author: lofwyr
Date: Fri Mar  4 21:42:44 2016
New Revision: 1733657

URL: http://svn.apache.org/viewvc?rev=1733657&view=rev
Log:
TOBAGO-1539: Using Servlet 3.0 for uploading files with <tc:file>

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java?rev=1733657&r1=1733656&r2=1733657&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java Fri Mar  4 21:42:44 2016
@@ -37,6 +37,15 @@ public class PartUtilsUnitTest {
 
     final String dc1 = "form-data; name=\"page:file\"; filename=\"foo;bar=\\\"boo\\\"-bar.jpg\"";
     Assert.assertEquals("foo;bar=\"boo\"-bar.jpg", PartUtils.getSubmittedFileName(new PartMock(dc1)));
+
+/* XXX will fail, because a / will be encoded as a :
+    final String dc2
+        = "form-data; name=\"page:file1\"; filename=\"semicolon;doublequote\\\"backslash\\"
+        + "slash:doublebackslash\\\\quote'umlautsäöüumlautsäöüeuro€tilde~muµspace hiraganaぁ.jpg\"";
+    Assert.assertEquals(
+        "semicolon;doublequote\"backslash\\slash/doublebackslash\\\\quote'umlautsäöüumlautsäöüeuro€tilde~muµspace "
+            + "hiraganaぁ.jpg", PartUtils.getSubmittedFileName(new PartMock(dc2)));
+*/
   }
 
   private static final class PartMock implements Part {

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java?rev=1733657&r1=1733656&r2=1733657&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java Fri Mar  4 21:42:44 2016
@@ -56,6 +56,7 @@ public class Upload implements Serializa
     }
     LOG.info("type=" + part.getContentType());
     LOG.info("size=" + part.getSize());
+    LOG.info("cd = " + part.getHeader("Content-Disposition"));
     final String submittedFileName = PartUtils.getSubmittedFileName(part);
     LOG.info("name=" + submittedFileName);
     list.add(new UploadItem(submittedFileName, part.getSize(), part.getContentType()));