You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2010/07/22 23:19:51 UTC

[jira] Commented: (CXF-2903) Unexpected HTTP response code for @Consumes mismatch

    [ https://issues.apache.org/jira/browse/CXF-2903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12891342#action_12891342 ] 

Sergey Beryozkin commented on CXF-2903:
---------------------------------------

Hi

this is the rather cryptic code fragment :

int status = pathMatched == 0 ? 404 : methodMatched == 0 ? 405 
                     : consumeMatched == 0 ? 415 : produceMatched == 0 ? 406 : 404;

404 would be reported if either path not matched or if the candidate list is empty. Note that according to the spec
Consumes mismatch will result in 415 and Produces mismatch will result in 406.

I'd expect 415 in your case given that @Consumes does not match the media type. 

Can you enable DEBUG log level - it should give you more info about what is happening. Let us know the details please

> Unexpected HTTP response code for @Consumes mismatch
> ----------------------------------------------------
>
>                 Key: CXF-2903
>                 URL: https://issues.apache.org/jira/browse/CXF-2903
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.9
>            Reporter: Donal Fellows
>
> I have an interface with a method annotated as accepting XML (with {{@Consumes("application/xml")}} and {{@POST}}) and a class that implements that interface; the {{@Path}} is not matched for {{@POST}} by any other method. When I call it and pass in content with that MIME type, it all works. When I pass in content of another MIME type, I get a 404 response; this is unexpected, as I'd expect a 406 (Not Acceptable) response that tells me to pass in XML (to be clear, this _is_ an error case). Having to work around this by accepting all types and doing my own content type negotiation is unacceptable, especially since that decreases the utility of the generated WADL file significantly. Surely CXF should be doing this sort of work for me?

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