[ 
https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12992978#comment-12992978
 ] 

Bertrand Delacretaz commented on SLING-1974:
--------------------------------------------

Thinking again about this, I think the SlingPostServlet is currently doing it 
wrong: SlingHttpServletRequest.getResponseContentType() should be used to 
decide which content type to return, so if we want to take the Accept header 
into consideration that should be done there - probably using a new 
ResponseMimeTypeSelector service that implements the selection logic in a 
central place.

And maybe add a new getResponseContentType(options) where options specifies if 
the caller wants to consider only the extension, or extension + Accept header 
using whatever ResponseMimeTypeSelector service is currently active.

Using the Accept header as per the http spec is cool and useful, but in 
practice often unusable due to broken or badly configured clients - so I think 
we must give Sling users the choice of whether and how to use the Accept header.

> Accept header issues in the Sling POST Servlet
> ----------------------------------------------
>
>                 Key: SLING-1974
>                 URL: https://issues.apache.org/jira/browse/SLING-1974
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Post 2.1.0
>            Reporter: Felix Meschberger
>             Fix For: Servlets Post 2.1.2
>
>         Attachments: SLING-1974.patch
>
>
> As of SLING-1336 the Sling POST Servlet can interpret the Accept request 
> header to select what response content type to render.
> Unfortunately that handling seems broken as for an Accept header like (as 
> generated by FireFox with the JSONovich plugin installed) :
>    Accept: 
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,application/json
> the JSON response might be selected but sometimes also text/html (we can 
> observe both behaviours for different server platforms with our application).
> The Accept header should probably consider equivalent q values (as for 
> text/html and application/json in the example) to solve the tie by selecting 
> the first type list; thus text/html in this example.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to