users@jersey.java.net

Re: [Jersey] _at_ImplicitProduces and priorities <was> Re: [Jersey] prioritising HTML representations in web applications when using implicit or explicit views

From: James Strachan <james.strachan_at_gmail.com>
Date: Thu, 2 Apr 2009 12:39:14 +0100

2009/4/2 Dusan Hornik <dusan.hornik_at_atlassian.com>:
> Paul Sandoz wrote:
>
> Hi,
>
> Perhaps there are other ways we can improve this as well.
>
> e.g. @Produces on a template processor?
>
> Template Processor can be used to generate multiple formats html, json, etc
> so it's probably not a good idea.

You could always list the full list of all the possible mime types you
can produce - with whatever weighting you wish (e.g. to weight HTML
above XML etc).

Or maybe use a wildcard to avoid listing all the thing you can produce
but just weight what you prefer to generate?

@Produces("text/html;qs=5, */*")

[snip]

> As a workaround I am currently using a filter that modifies Accept headers
> of request and if it contains text/html then it will move it to the front.
> But I would prefer if it works without this workaround filter.

Yeah - this is what the "text/html;qs=5" is meant to do - to basically
make HTML the default response.

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/