Hi guys, Here is the case I've met:
I have 2 methods with @produces:
@POST
@Produces("application/json")
public String postStuff()
@POST
@Produces("text/html")
public String postStuffHtml()
Use IE to access the url.
1. If accept header is default, return html.
IE's default Accept header: 'image/jpeg,
application/x-ms-application, image/gif,application/x-shockwave-flash,
*/*'
Sometimes it's just '*/*'
2. Return json if accept header is 'application/json, */*'
The problem is that I can't find a good way to change/retain the order
of the 2 @produces.
- So if the method with @Produces("application/json") comes first, in
case 1 json will always match '*/*' first and returned.
- If I add 'qs=5' for @Produces("text/html"), then case 1 is fixed. But
in case 2 html will be returned .
IE's header is urgly, but I wonder if there is anyway in jersey to
solve this issue. Just need to make sure the @Produces("text/html") is
in the first place then problem solved.
Thanks for help.