CXF failed to deal with attachment if client sends in attachment with 
"Multipart/Related" instead of "multipart/related" as Content-type
----------------------------------------------------------------------------------------------------------------------------------------

                 Key: CXF-2043
                 URL: https://issues.apache.org/jira/browse/CXF-2043
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.1.4
         Environment: Solaris 10, WinXP Pro
            Reporter: Joe Luo


Here is source code from cxf-2.1.x-fixes branch for 
*org.apache.cxf.attachment.AttachmentUtil.java*
{code}
 public static boolean isTypeSupported(String contentType, List<String> types) {
        if (contentType == null) {
            return false;
        }
        for (String s : types) {
            if (contentType.indexOf(s) != -1) {
                return true;
            }
        }
        return false;
    }
{code}

So if a client sends in a SOAP request with attachment with *Content-Type* as 
"Multipart/Related" instead of "multipart/related", then this method will 
always return *false* as result. The spec says that the Content-Type should be 
case-insensitive. It should not matter whether the client sends in 
"Multipart/Related" or "multipart/related".

I have attached a patch to fix this. Basically, I just simply modified this 
method to:
{code}
public static boolean isTypeSupported(String contentType, List<String> types) {
        if (contentType == null) {
            return false;
        }
        for (String s : types) {
            if (contentType.toLowerCase().indexOf(s) != -1) {
                return true;
            }
        }
        return false;
    }
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to