[
https://issues.apache.org/jira/browse/OAK-8135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Davide Giannella closed OAK-8135.
---------------------------------
bulk close 1.12.0
> HTTP service may not select correct media type if multiple are specified in
> Accept header field
> -----------------------------------------------------------------------------------------------
>
> Key: OAK-8135
> URL: https://issues.apache.org/jira/browse/OAK-8135
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: oak-http
> Reporter: Henry Saginor
> Assignee: Julian Reschke
> Priority: Minor
> Labels: candidate_oak_1_10
> Fix For: 1.12.0
>
> Attachments: MediaRange.patch, OAK-8135.diff
>
>
> Steps to reproduce:
> With HTTPie
> {code:java}
> > http -j -b -a admin:admin localhost:8080{code}
> or with cUrl
> {code:java}
> > curl -u admin:admin http://localhost:8080 --header "Accept:
> > application/json, */*"{code}
> In both of the above cases http service selects the first available
> representation (aka HTML) based on "**/**" instead of more specific JSON.
> I think one possible fix is to by default assign higher weight to more
> specific mime types when Accept header is parsed in
> org.apache.jackrabbit.oak.http.MediaRange.parse
> For example replacing return statement in above method with the following
> fixed this bug in my testing:
> {code:java}
> double defaultQ = 3.0;
> if("*/*".equals(type.getType())) {
> defaultQ = 1.0;
> } else if("*".equals(type.getSubtype())) {
> defaultQ = 2.0;
> }
>
> return new MediaRange(type, defaultQ);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)