dev@glassfish.java.net

Re: REST interface on Chrome

From: Bruno Harbulot <Bruno.Harbulot_at_manchester.ac.uk>
Date: Thu, 03 Jun 2010 18:07:45 +0100

Hi,

I've also had similar problems with older versions of Firefox (I can't
remember exactly, but this blog mentions FF 2). MSIE also accepts "*/*"
by default (preceded by word, jpeg, etc, depending on what's installed
on the machine as far as I understand), which isn't always helpful
either: it depends on what the service thinks it should return for "*/*"
by default (and why should it be HTML?).

One of the ways around this is to do some user-agent detection. The
Restlet framework does this, for example, using a configuration file [1]
to replace Accept when certain conditions are met (original Accept
header and user-agent), via its TunnelService [2].
It may sound like a convoluted workaround, but the end result (for apps
developed on top of Restlet) is actually fairly neat in general (since
it's hidden and content-negotiation works as expected then).

Best wishes,

Bruno.


[1]
http://restlet.tigris.org/source/browse/restlet/trunk/modules/org.restlet/src/org/restlet/service/accept.properties?revision=6406&view=markup
[2]
http://www.restlet.org/documentation/2.0/jse/api/org/restlet/service/TunnelService.html

On 03/06/10 17:00, Alexis Moussine-Pouchkine wrote:
> unfortunately Chrome and Safari (WebKit?) prefer XML over HTML.
> http://www.gethifi.com/blog/webkit-team-admits-accept-header-error
> -Alexis
>
> On 3 juin 2010, at 17:56, Tom Mueller wrote:
>
>> The REST management interface (http://server:4848/management/domain) is returning XML when accessed via Google Chrome. IE and Firefox both return HTML.
>> Is this expected?
>>
>> Thanks.
>> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>