cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wei Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CXF-6256) Unexpected response code
Date Fri, 13 Feb 2015 02:57:11 GMT

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

Wei Zhang updated CXF-6256:
---------------------------
    Description: 
This is a CTS testcase, the resource class is like this:
@Path("/hello")
public class HelloRestService {

    @GET
    @Produces("text/*")
    public String test() {
        return getClass().getSimpleName();
    }
}

Access the method with client which accept "text/*" as media type.
Currently, I got response 200, and media type is application/octet-stream.

But according to jsr339 section 3.8 Determining the MediaType of Responses:
Step 8: For each member of M;m:
• If m is a concrete type, set Mselected = m, finish.
Here M has only one member: m="text/*" is not a concrete type, so goto step 9.

Step 9. If M contains ‘*/*’ or ‘application/*’, set Mselected = ‘application/octet-stream’,
finish.
"test/*" does not contain "*/*" or "application/*", so goto step 10.

Step 10. Generate a NotAcceptableException (406 status) and no entity. The exception MUST
be processed
as described in Section 3.3.4. Finish.

So the expected response code should be 406, not 200.

  was:
This is a CTS testcase, the resource class is like is:
@Path("/hello")
public class HelloRestService {

    @GET
    @Produces("text/*")
    public String test() {
        return getClass().getSimpleName();
    }
}

Access the method with client which accept "text/*" as media type.
Currently, I got response 200, and media type is application/octet-stream.

But according to jsr339 section 3.8 Determining the MediaType of Responses:
Step 8: For each member of M;m:
• If m is a concrete type, set Mselected = m, finish.
Here M has only one member: m="text/*" is not a concrete type, so goto step 9.

Step 9. If M contains ‘*/*’ or ‘application/*’, set Mselected = ‘application/octet-stream’,
finish.
"test/*" does not contain "*/*" or "application/*", so goto step 10.

Step 10. Generate a NotAcceptableException (406 status) and no entity. The exception MUST
be processed
as described in Section 3.3.4. Finish.

So the expected response code should be 406, not 200.


> Unexpected response code
> ------------------------
>
>                 Key: CXF-6256
>                 URL: https://issues.apache.org/jira/browse/CXF-6256
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.0.3
>         Environment: Windows
>            Reporter: Wei Zhang
>
> This is a CTS testcase, the resource class is like this:
> @Path("/hello")
> public class HelloRestService {
>     @GET
>     @Produces("text/*")
>     public String test() {
>         return getClass().getSimpleName();
>     }
> }
> Access the method with client which accept "text/*" as media type.
> Currently, I got response 200, and media type is application/octet-stream.
> But according to jsr339 section 3.8 Determining the MediaType of Responses:
> Step 8: For each member of M;m:
> • If m is a concrete type, set Mselected = m, finish.
> Here M has only one member: m="text/*" is not a concrete type, so goto step 9.
> Step 9. If M contains ‘*/*’ or ‘application/*’, set Mselected = ‘application/octet-stream’,
finish.
> "test/*" does not contain "*/*" or "application/*", so goto step 10.
> Step 10. Generate a NotAcceptableException (406 status) and no entity. The exception
MUST be processed
> as described in Section 3.3.4. Finish.
> So the expected response code should be 406, not 200.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message