cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1221515 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/
Date Tue, 20 Dec 2011 23:07:02 GMT
Author: sergeyb
Date: Tue Dec 20 23:07:02 2011
New Revision: 1221515

URL: http://svn.apache.org/viewvc?rev=1221515&view=rev
Log:
Merged revisions 1221511 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1221511 | sergeyb | 2011-12-20 22:51:55 +0000 (Tue, 20 Dec 2011) | 1 line
  
  [CXF-3987] Removing confusing Multipart checks when reading plain multipart/form-data payloads
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec 20 23:07:02 2011
@@ -1 +1 @@
-/cxf/trunk:1221204,1221208,1221221,1221226
+/cxf/trunk:1221204,1221208,1221221,1221226,1221511

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java?rev=1221515&r1=1221514&r2=1221515&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
Tue Dec 20 23:07:02 2011
@@ -147,7 +147,7 @@ public class FormEncodingProvider implem
         if (mt.isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)) {
             MultipartBody body = 
                 AttachmentUtils.getMultipartBody(mc, attachmentDir, attachmentThreshold,
attachmentMaxSize);
-            FormUtils.populateMapFromMultipart(params, anns, body, decode);
+            FormUtils.populateMapFromMultipart(params, body, decode);
         } else {
             String enc = HttpUtils.getEncoding(mt, "UTF-8");
             FormUtils.populateMapFromString(params, 

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=1221515&r1=1221514&r2=1221515&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
Tue Dec 20 23:07:02 2011
@@ -23,7 +23,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.lang.annotation.Annotation;
 import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -41,7 +40,6 @@ import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
 import org.apache.cxf.jaxrs.ext.multipart.ContentDisposition;
-import org.apache.cxf.jaxrs.ext.multipart.Multipart;
 import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 
@@ -140,23 +138,20 @@ public final class FormUtils {
     }
     
     public static void populateMapFromMultipart(MultivaluedMap<String, String> params,
-                                                Annotation[] anns,
                                                 MultipartBody body, 
                                                 boolean decode) {
         List<Attachment> atts = body.getAllAttachments();
         for (Attachment a : atts) {
             ContentDisposition cd = a.getContentDisposition();
-            if (cd == null || !MULTIPART_FORM_DATA_TYPE.equalsIgnoreCase(cd.getType())
-                || cd.getParameter("name") == null) {
-                Multipart id = AnnotationUtils.getAnnotation(anns, Multipart.class);
-                
-                if (id == null || id.required()) {
-                    throw new WebApplicationException(400);
-                } else {
-                    return;
-                }
+            if (cd == null || !MULTIPART_FORM_DATA_TYPE.equalsIgnoreCase(cd.getType())) {
+                continue;
+            }
+            String cdName = cd.getParameter("name");
+            String contentId = a.getContentId();
+            String name = StringUtils.isEmpty(cdName) ? contentId : cdName.replace("\"",
"").replace("'", "");
+            if (StringUtils.isEmpty(name)) { 
+                throw new WebApplicationException(400);
             }
-            String name = cd.getParameter("name").replace("\"", "").replace("'", "");
             try {
                 String value = IOUtils.toString(a.getDataHandler().getInputStream());
                 params.add(HttpUtils.urlDecode(name),

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1221515&r1=1221514&r2=1221515&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
Tue Dec 20 23:07:02 2011
@@ -745,7 +745,7 @@ public final class JAXRSUtils {
                 if (mt != null && "multipart".equalsIgnoreCase(mt.getType()) 
                     && MediaType.MULTIPART_FORM_DATA_TYPE.isCompatible(mt)) {
                     MultipartBody body = AttachmentUtils.getMultipartBody(mc);
-                    FormUtils.populateMapFromMultipart(params, paramAnns, body, decode);
+                    FormUtils.populateMapFromMultipart(params, body, decode);
                 } else {
                     org.apache.cxf.common.i18n.Message errorMsg = 
                         new org.apache.cxf.common.i18n.Message("WRONG_FORM_MEDIA_TYPE", 

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java?rev=1221515&r1=1221514&r2=1221515&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
Tue Dec 20 23:07:02 2011
@@ -20,7 +20,6 @@
 package org.apache.cxf.jaxrs.utils.multipart;
 
 import java.io.IOException;
-import java.lang.annotation.Annotation;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -141,7 +140,6 @@ public final class AttachmentUtils {
                                                                 boolean errorIfMissing) {
         MultivaluedMap<String, T> data = new MetadataMap<String, T>();
         FormUtils.populateMapFromMultipart((MultivaluedMap)data,
-                                           new Annotation[]{},
                                            AttachmentUtils.getMultipartBody(mc), 
                                            true);
         return data;



Mime
View raw message