You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Willem Jiang (JIRA)" <ji...@apache.org> on 2009/02/17 14:31:00 UTC

[jira] Resolved: (CXF-2043) CXF failed to deal with attachment if client sends in attachment with "Multipart/Related" instead of "multipart/related" as Content-type

     [ https://issues.apache.org/jira/browse/CXF-2043?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CXF-2043.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.5
                   2.2

Trunk
http://svn.apache.org/viewvc?rev=744237&view=rev
2.1.x
http://svn.apache.org/viewvc?rev=745035&view=rev

> 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
>            Assignee: Willem Jiang
>             Fix For: 2.2, 2.1.5
>
>         Attachments: multipart.patch
>
>
> 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.