[ 
https://issues.apache.org/jira/browse/WINK-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750438#action_12750438
 ] 

Eli Baram commented on WINK-162:
--------------------------------

The suggestion is to narrow the option that the server can select from, to the 
ones that can be handled by the client.
e.g.
Assume: 
1) The server exposes "/users" resource in HTML and XML representations.
2) The client has MessageBodeyReader <Users> that can handle XML, but has no 
such reader that can handle html.

Today, if no accept is set, the client sends accept: */*, the server might 
return HTML and when the response returns to the client an Exception is thrown 
indicate that no reader was found that can de serialized HTML to Users.

The suggestion limit the accept header, in this case, to XML only, the server 
will return XML and the de serialization will success, Happy End :-)






> The client should send appropriate accept header when no accept specified
> -------------------------------------------------------------------------
>
>                 Key: WINK-162
>                 URL: https://issues.apache.org/jira/browse/WINK-162
>             Project: Wink
>          Issue Type: Improvement
>          Components: Client
>            Reporter: Eli Baram
>
> Wink client hold all the providers that can be used to de serialize the 
> response, therefore if no accept is set by the user, wink can do the 
> fallowing to define the accept header (pseudo code ):
> {code}
> foreach (MessageBodyReader){
>   if(MessageBodyReader generics fits requested class){
>     foreach (MediaType in provider's Consume annotation){
>       if(provider.isReadable(requested class, media type)     
>         add MediaType to accept header
>       }
>     }
> }
> {code}

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

Reply via email to