You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Ka-Lok Fung (JIRA)" <ji...@apache.org> on 2011/05/18 03:13:47 UTC

[jira] [Created] (CXF-3531) CXF doesn't always generate 415 when POSTing to a resource with an invalid media type

CXF doesn't always generate 415 when POSTing to a resource with an invalid media type
-------------------------------------------------------------------------------------

                 Key: CXF-3531
                 URL: https://issues.apache.org/jira/browse/CXF-3531
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.3.4, 2.4
         Environment: JDK 1.6
            Reporter: Ka-Lok Fung
            Priority: Minor
             Fix For: 2.4.1, 2.3.5


When you POST to a resource using an invalid Content-Type of "foo", CXF doesn't return 415.

Instead, CXF throws a 500 because an IllegalArgumentException is thrown instead of a WebApplicationException.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CXF-3531) CXF doesn't always generate 415 when POSTing to a resource with an invalid media type

Posted by "Ka-Lok Fung (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ka-Lok Fung updated CXF-3531:
-----------------------------

    Attachment: cxf.post.mediatype.trunk.diff

Potential patch for this issue.

Basically, if an {{IllegalArgumentException}} while parsing the MediaType, we will convert that into a {{WebApplicationException}} with a 415 status code.

Added a systest to catch this scenario. Unfortunately, I had to use {{HttpURLConnection}} instead of {{WebClient}} because {{WebClient}} actually validates media types :)

> CXF doesn't always generate 415 when POSTing to a resource with an invalid media type
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-3531
>                 URL: https://issues.apache.org/jira/browse/CXF-3531
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4, 2.3.4
>         Environment: JDK 1.6
>            Reporter: Ka-Lok Fung
>            Priority: Minor
>             Fix For: 2.4.1, 2.3.5
>
>         Attachments: cxf.post.mediatype.trunk.diff
>
>
> When you POST to a resource using an invalid Content-Type of "foo", CXF doesn't return 415.
> Instead, CXF throws a 500 because an IllegalArgumentException is thrown instead of a WebApplicationException.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CXF-3531) CXF doesn't always generate 415 when POSTing to a resource with an invalid media type

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-3531.
-----------------------------------

    Resolution: Fixed
      Assignee: Sergey Beryozkin

patch applied, thanks.
Actually, I forgot again to mention the contributor's name in the commit message, really sorry. The patch point has been accumulated anyway, thanks

> CXF doesn't always generate 415 when POSTing to a resource with an invalid media type
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-3531
>                 URL: https://issues.apache.org/jira/browse/CXF-3531
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.4, 2.3.4
>         Environment: JDK 1.6
>            Reporter: Ka-Lok Fung
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 2.4.1, 2.3.5
>
>         Attachments: cxf.post.mediatype.trunk.diff
>
>
> When you POST to a resource using an invalid Content-Type of "foo", CXF doesn't return 415.
> Instead, CXF throws a 500 because an IllegalArgumentException is thrown instead of a WebApplicationException.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira