[jira] [Commented] (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13492246#comment-13492246 ] Felix Meschberger commented on SLING-1974: -- Since the order of equally weighted content types is not defined and thus is not deterministic, Sling works correctly and we have nothing to do here IMHO. I would prefer to resolve this issue as won't fix. 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 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. 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] (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13197708#comment-13197708 ] Felix Meschberger commented on SLING-1974: -- Lets postpone to the next release... 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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13197658#comment-13197658 ] Carsten Ziegeler commented on SLING-1974: - I just reread this issue (in order to prepare the next release) and I fail to see how we should resolve this? Any ideas? 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. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992929#comment-12992929 ] Felix Meschberger commented on SLING-1974: -- Thanks for the link. I crosschecked the implementation: It internally uses a TreeSet to manage the quality tagged types. Provided q values are equal for two entries in the Accept header, they are ordered by their MIME type causing application/json to be order before text/html. I think this is wrong and should be changed to order by their location in the header. While browser might not place specific preference on entries with the same q value (and the spec fails to clarify), I think it is more natural to use the declaration order in the header than it is to use string ordering. 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 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992941#comment-12992941 ] Bertrand Delacretaz commented on SLING-1974: I much prefer Jukka's proposal to use server-side configured preferences. It's much more predictable than relying on the client ordering of the entries. We can simply add an ordered list of preferred content types to the post servlet configuration, and use those to resolve ties. 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992963#comment-12992963 ] Alexander Klimetschek commented on SLING-1974: -- use server-side configured preferences +1 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992980#comment-12992980 ] Felix Meschberger commented on SLING-1974: -- The problem is, that the more we add, the more complex it becomes ... Currently it behaves like this: If there is a :http-equiv-accept request parameter use that as the list of media types accepted/requested Otherwise consider the Accept request header Then build an internal sorted set from this value. Sort order is defined by the q value and the concreteness of the main and sub types. That is text/html comes before text/*. In a tie the types are string-compared. My patch replaces the string-comparison by a declaration order thing. Which IMHO can be much better defined. So, basically, we do not need another mechanism to overwrite this ... the client can overwrite the default Accept header with an :http-equiv-accept request attribute and we are fine IMHO. 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992981#comment-12992981 ] Alexander Klimetschek commented on SLING-1974: -- @Carsten: I (and Bertrand, IIUC) meant server-side prefs only for conflicts in the accept header (i.e. two mime-types with equal weight), where as per the HTTP spec there is no preference given by the client. So it's perfectly fine to use a server preference in this case. As noted in the link from Jukka, this will make the response stable (even if you consider the request to be broken in this case). Currently the handling is also decided by the server - by sorting alphabetically by the mime-type - hence it is stable, but not configurable. On the other hand, I guess this is a very specific case, and is in most cases better solved by fixing the client or supporting the simpler extension-based selection of response types. 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992982#comment-12992982 ] Alexander Klimetschek commented on SLING-1974: -- the client can overwrite the default Accept header with an :http-equiv-accept request --attribute-- parameter Are extensions supported? I think this would be more consistent with Sling's request processing where the extension takes a central role (and the accept header isn't used at all). 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992989#comment-12992989 ] Felix Meschberger commented on SLING-1974: -- Are extensions supported? Not at the moment. SlingHttpServletRequest.getResponseContentType() We implement that method by looking at the request extension (getResponseContentTypes() returns an Enumeration just containing getResponseContentType()). I think this is a good approach: - getResponseContentType() returns a primary requested type by the client: 1. derived from the request extension (if any) 2. derived from Accept header (as per today's MediaRangeList) - getResponseContentTypes() returns an enumeration containing 1. type derived from the request extension (if any) 2. types derived from Accept header (in q and declaration order) - getResponseContentType(String.. supported) returns the response content type amongst the supported types being returned first by the getResponseContentTypes() enumeration Finally the Sling POST Servlet might use the SlingHttpServletResponse.getResponseContentType(text/html, text/json) call to get the desired type Alternatively: - keep the SlingHttpServletResponseImpl implementation as it is (and no API extension) - create a request filter overwriting the getResponseContentType and getResponseContentTypes() methods along the lines defined above - have the Sling POST Servlet check the getResponseContentTypes() enumeration and selecting the first supported content type from the enumeration Actually, I would prefer the filter solution because it does not require changes to the API or the engine bundle and is ultimatively flexible. In fact this is a similar solution as we chose for I18N support and the getLocale methods. WDYT ? 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992999#comment-12992999 ] Alexander Klimetschek commented on SLING-1974: -- If we don't want to change the API at this point, we could just leave out adding getResponseContentType(String.. supported) and do this logic inside the SlingPostServlet. A utility method taking both the getResponseContentTypes() enumeration and an ordered list of supported types from the servlet is probably better than putting this into the request API. Then you only have to adapt the implementation for getResponseContentType()/getResponseContentTypes() to add 2. (accept header). I think we have too many filters already, makes the stack traces so long ;-) BTW: Is getResponseContentType() / getResponseContentTypes() used for the servlet resolution? (mapping mime-types back to plain extensions) 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12993029#comment-12993029 ] Felix Meschberger commented on SLING-1974: -- I think we have too many filters already, makes the stack traces so long ;-) I am sure, this is a joke ;-) The reason for the filter is that we are more flexible and I don't want to grow the Engine too much. BTW: Is getResponseContentType() / getResponseContentTypes() used for the servlet resolution? No, it is not used. For Mime Type mapping we either use the ServletContext.getMimeType method (which is backed by the MimeTypeService) or use the MimeTypeService directly. 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12993045#comment-12993045 ] Alexander Klimetschek commented on SLING-1974: -- The reason for the filter is that we are more flexible and I don't want to grow the Engine too much. Sling's SlingHttpServletRequest API defines getResponseContentType(), so I wonder why this should be implemented in a filter and not in SlingHttpServletRequestImpl itself (making the current implementation of it useless). Servlet filters IMO only make sense if an application wants to generally wrap things for all servlets, if an applications wants to overwrite servlet-container default logic or have something that is active or not depending on the request. In this case however, I think we agree that this is core framework logic. Only if someone wants to change it, she could write a filter to provide a different logic for response content types. 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
[jira] Commented: (SLING-1974) Accept header issues in the Sling POST Servlet
[ https://issues.apache.org/jira/browse/SLING-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12992554#comment-12992554 ] Jukka Zitting commented on SLING-1974: -- The HTTP spec doesn't specify any ordering for the values and some clients may use a non-deterministic ordering (e.g. hash set), so relying on the ordering might cause unexpected results in some cases. A better approach might be to use explicit server-side preferences (like text/html over application/json) or alphabetic ordering as a deterministic fallback. See also http://www.neeraj.name/2010/11/23/mime-type-resolution-in-rails.html (and especially Erik's comment) for a good discussion of related issues. 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 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