users@jersey.java.net

Re: [Jersey] Re: Content Negociation

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 21 Jan 2009 12:33:22 +0100

On Jan 21, 2009, at 12:22 PM, amsmota_at_gmail.com wrote:

> Ooops, it seems my premiss was wrong, I was testing with a browser
> instead of my rest client, and it seems the browser added some
> stuff, so what I really have is
>
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
> *;q=0.8, application/octet-stream,application/pdf
>

I thought so :-) because text/html occurs before application/pdf the
former is considered the most acceptable.


> But the question still ineterest me, how does Jersey handles the
> situation I mentioned?
>

It will work :-) I recommend using curl to experiment:

  curl -v -H "Accept: application/octet-stream, application/pdf" <url>

or using a firefox plugin like Poster.

Paul.

> Cheers.
>
>
>
>
> On Jan 21, 2009 11:10am, amsmota_at_gmail.com wrote:
> > I searched the archives and although there are many things about
> conneg the ones I saw are basically of the type
> >
> > Accept: xxx/xxx
> > @Produces({"application/xml", "application/json"})
> >
> > But my question is the opposite, in concrete
> >
> > Accept: application/octet-stream, application/pdf
> >
> > @Produces("text/html")
> > produceHtml()
> >
> > @Produces("application/pdf")
> > producePdf()
> >
> > I was expecting the producePdf being executed, but I got the html
> one. How does Jersey handles situations like this?
> >
> > Also, does Jersey considers the quality values when matching mime
> types?
> >
> >
> > Cheers.