users@jersey.java.net

browser accept header weirdness

From: <FSauer_at_dsthealthsolutions.com>
Date: Wed, 7 Oct 2009 13:45:54 -0500

The bookstore example as it comes out of the box in 1.0.3 and 1.1.2ea
exposes a strange browser discrepancy:

I added a debug statement in the Bookstore.getItem method to print the
Accept header as follows (and this one line is the only change to the
example code):

    @Path("items/{itemid}/")
    public Item getItem(@PathParam("itemid") String itemid, @Context
HttpServletRequest req) {
        System.err.println(req.getHeader("Accept"));
        Item i = getItems().get(itemid);
        if (i == null)
            throw new NotFoundException("Item, " + itemid + ", is not
found");

        return i;
    }

This shows the following results when accessing
http://localhost:8080/bookstore/items/1:

Browser Accept header result
====================================================================
Firefox text/html,
                application/xhtml+xml,
                application/xml;q=0.9,
                */*;q=0.8 HTML
Safari application/xml,
                application/xhtml+xml,
                text/html;q=0.9,
                text/plain;q=0.8,
                image/png,
                */*;q=0.5 HTML
IE */* XML(!)

Is there a known problem with jersey's handling of */* when using implicit
views?
In both versions of the example the resources are annotated with
@ImplicitProduces("text/html;qs=5")

Any ideas?


Frank Sauer
Principal Architect
DST Health Solutions
2500 Corporate Drive
Birmingham, AL 35242
(205)437-5204 (Office) (Direct)
(205)568-4684 (Cell)
fsauer_at_dsthealthsolutions.com
It is impossible to sharpen a pencil with a blunt axe. It is equally vain
to try to do it with ten blunt axes instead -- Edsger W. Dijkstra


-----------------------------------------
Please consider the environment before printing this email and any
attachments.

This e-mail and any attachments are intended only for the
individual or company to which it is addressed and may contain
information which is privileged, confidential and prohibited from
disclosure or unauthorized use under applicable law. If you are
not the intended recipient of this e-mail, you are hereby notified
that any use, dissemination, or copying of this e-mail or the
information contained in this e-mail is strictly prohibited by the
sender. If you have received this transmission in error, please
return the material received to the sender and delete all copies
from your system.





picture
(image/gif attachment: 01-part)