[
https://issues.apache.org/jira/browse/CXF-6754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15114931#comment-15114931
]
Sergey Beryozkin commented on CXF-6754:
---------------------------------------
Hi Neal
406 is only returned when Accept is *not acceptable*.
However text/wildcard intersects with text/wildcard and the runtime does select
and invoke the getText() method.
So we can not really return 406 after actually *accepting* the request.
You are right a text/star would not be a proper response content type - but the
spec says that when a content type has a wildcard subtype, then, unless it is
application/star it has to become application/octet-stream.
I suspect that someone in the TCK team assumed that a text/wildcard does not
intersect and therefore asserted it had to be 406. But text/wildcard does
intersect with text/wildcard, it is: text/wildcard;q=0;qs=0;d=0. The test
outcome should be:
{noformat}
Content-Type:application/octet-stream
text/* is OK
{noformat}
Cheers, Sergey
> Determin Media Type in Response
> -------------------------------
>
> Key: CXF-6754
> URL: https://issues.apache.org/jira/browse/CXF-6754
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.0.7, 3.1.4
> Environment: Windows
> Reporter: Neal Hu
> Fix For: 3.1.5, 3.0.8, 3.2.0
>
> Attachments: JAXRSOutInterceptor.patch
>
>
> @GET
> @Path("text")
> @Produces(value = "text/*")
> public String geText() {
> return "text/* is ok";
> }
> request Accept=text/*
> Per spec 3.8|2
> 2. Gather the set of producible media types P:
> • If the method is annotated with @Produces, set P = fV (method)g where V (t)
> represents the
> values of @Produces on the specified target t.
> • Else if the class is annotated with @Produces, set P = fV (class)g.
> • Else set P = fV (writers)g where ‘writers’ is the set of MessageBodyWriter
> that support the
> class of the returned entity object.
> Check the resource method anno first then class anno, at last check writers.
> So the response code should be 406.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)