[
https://issues.apache.org/jira/browse/WINK-47?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12728737#action_12728737
]
Bryant Luk commented on WINK-47:
--------------------------------
I haven't had any caffeine this morning but I think the scenario for this
wasn't really about the ContextResolvers but more about the
Providers.getMessageBodyWriter(...., MediaType mt). It could be that someone
calling the providers just wants to see if there was a writer for a Class<?>
type, Type genericType for any media type. It just so happened that if the
interpretation of getMessageBodyWriter() were taken that way, then
getContextResolvers() would have followed the same behavior.
{code}
@GET
public void getSomething(@Context Providers p, @Context ServletContext s,
@Context HttpHeaders headers) {
Object o = // some object
MediaType acceptMT = // get the Accept header media type and it happens
to be */*
MessageBodyWriter mbw = p.getMessageBodyWriter(o.getClass(), o.getClass(),
new Annotation[0] { }, acceptMT);
// get the servlet context and set Content-Type to be acceptMT (if it was
wildcard i would hope they would just return)
// if (mbw != null) writeTo...., etc.
}
{code}
*In the end*, I don't think this is something to really worry about given
comments in this JIRA.
I would be curious if anyone's interpretation is asking for the MediaType
"widening" though (i.e. first do a specific text/plain match, then do a text/*,
then do */*). I prefer the current behavior, but if it's really a literal
match for the MediaTypes passed into the Providers interface, then that makes
things a bit easier. I could see the application developer being forced to do
the type widening on their own.
Regarding:
> Another question: should we support patterns like "text/plain*"?
That's an interesting point and I think we should open another JIRA for it.
> honor media type wildcards
> --------------------------
>
> Key: WINK-47
> URL: https://issues.apache.org/jira/browse/WINK-47
> Project: Wink
> Issue Type: Bug
> Components: Common
> Affects Versions: 0.1
> Reporter: Mike Rheinheimer
> Fix For: 0.1
>
> Attachments: patch.txt, patch_02.txt
>
>
> This issue probably needs discussion, as it may be a spec interpretation
> issue. Please reference JAX-RS javadoc for
> javax.ws.rs.ext.Providers.getContextResolver here:
> http://jackson.codehaus.org/javadoc/jax-rs/1.0/javax/ws/rs/ext/Providers.html#getContextResolver(java.lang.Class,%20javax.ws.rs.core.MediaType)
> Currently, the implementation does not use the '*' character in a passed-in
> media type as a wildcard. Rather, it matches exactly by just allowing the
> LinkedHashMap.get to it's object compare. Attached is a patch with tests
> that demonstrate the proposed function, and a fix that supports it. All
> existing and new tests in wink-common and wink-server passed for me with this
> change.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.