You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wink.apache.org by "Reto Bachmann-Gmür (JIRA)" <ji...@apache.org> on 2012/11/25 22:56:58 UTC

[jira] [Created] (WINK-374) MessageBodyWriter writeTo getting wrong MediaType

Reto Bachmann-Gmür created WINK-374:
---------------------------------------

             Summary: MessageBodyWriter writeTo getting wrong MediaType
                 Key: WINK-374
                 URL: https://issues.apache.org/jira/browse/WINK-374
             Project: Wink
          Issue Type: Bug
            Reporter: Reto Bachmann-Gmür


When the resource method does not specify a MediaType with @Produces the MessageBodyWriters writeTo method gets invoked with the first media type in the Accept header as mediaType parameter. This is wron, according to section 3.8 of the spec it should be applicat8ion/octet-stream.

It is important that the the MessageBody Writer knows if the type was restricted by the resource method (in which case it should get the respective media-type) or not, in which case it might set the http header itself based on the instance to be written.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WINK-374) MessageBodyWriter writeTo getting wrong MediaType

Posted by "Reto Bachmann-Gmür (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13505443#comment-13505443 ] 

Reto Bachmann-Gmür commented on WINK-374:
-----------------------------------------

A work around it to annotate the resource method with @Produces(MediaType.APPLICATION_OCTET_STREAM)
                
> MessageBodyWriter writeTo getting wrong MediaType
> -------------------------------------------------
>
>                 Key: WINK-374
>                 URL: https://issues.apache.org/jira/browse/WINK-374
>             Project: Wink
>          Issue Type: Bug
>            Reporter: Reto Bachmann-Gmür
>
> When the resource method does not specify a MediaType with @Produces the MessageBodyWriters writeTo method gets invoked with the first media type in the Accept header as mediaType parameter. This is wron, according to section 3.8 of the spec it should be applicat8ion/octet-stream.
> It is important that the the MessageBody Writer knows if the type was restricted by the resource method (in which case it should get the respective media-type) or not, in which case it might set the http header itself based on the instance to be written.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WINK-374) MessageBodyWriter writeTo getting wrong MediaType

Posted by "Luciano Resende (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13507714#comment-13507714 ] 

Luciano Resende commented on WINK-374:
--------------------------------------

Would you be willing to provide a patch to fix the actual problem. That would be much appreciated.
                
> MessageBodyWriter writeTo getting wrong MediaType
> -------------------------------------------------
>
>                 Key: WINK-374
>                 URL: https://issues.apache.org/jira/browse/WINK-374
>             Project: Wink
>          Issue Type: Bug
>            Reporter: Reto Bachmann-Gmür
>
> When the resource method does not specify a MediaType with @Produces the MessageBodyWriters writeTo method gets invoked with the first media type in the Accept header as mediaType parameter. This is wron, according to section 3.8 of the spec it should be applicat8ion/octet-stream.
> It is important that the the MessageBody Writer knows if the type was restricted by the resource method (in which case it should get the respective media-type) or not, in which case it might set the http header itself based on the instance to be written.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (WINK-374) MessageBodyWriter writeTo getting wrong MediaType

Posted by "Reto Bachmann-Gmür (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WINK-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13510494#comment-13510494 ] 

Reto Bachmann-Gmür commented on WINK-374:
-----------------------------------------

I just looked at the source to see if I could at least provide a test that shows the problem. But I didn't find some examples I could have adapted. I saw however that a FileProvider - MessageBodyWriter exists, this could benefit from this issue being fixed and guess the media type from the extension if the resource method doesn't specify one (such as by using URLConnection.guessContentTypeFromName).
                
> MessageBodyWriter writeTo getting wrong MediaType
> -------------------------------------------------
>
>                 Key: WINK-374
>                 URL: https://issues.apache.org/jira/browse/WINK-374
>             Project: Wink
>          Issue Type: Bug
>            Reporter: Reto Bachmann-Gmür
>
> When the resource method does not specify a MediaType with @Produces the MessageBodyWriters writeTo method gets invoked with the first media type in the Accept header as mediaType parameter. This is wron, according to section 3.8 of the spec it should be applicat8ion/octet-stream.
> It is important that the the MessageBody Writer knows if the type was restricted by the resource method (in which case it should get the respective media-type) or not, in which case it might set the http header itself based on the instance to be written.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira