Feb 23rd, 2012, 01:58 AM
Accept header resolution (text/plain; q=0.5, application/json)
We have started to use org.springframework.web.servlet.mvc.method.annotat ion.RequestMappingHandlerAdapter and found out the following behavior. If the client sends Accept="text/plain; q=0.5, application/json" then the result has Content-type=text/plain. The cause is that MediaType.sortBySpecificity(mediaTypes) ignores "q" parameter if the types are different (text!=application).
Is it a bug? It is certainly counterintuitive. If there is a reason behind this, could you please provide me with some link where this behavior is explained.
Feb 24th, 2012, 01:48 AM