Hello Bruce,

could you have a look at this page [1] of the user guide? And at the 
javadocs of the tunnelService class [2], and ClientInfo class [3].
The solution is based on two properties files.
One (agent.properties), helps to match the user-agent string (sent by 
the browser) and extract some information such as the agent name 
(Safari, for example). Some browsers have been identified (especially 
Safari 2 and 3).
The other one is called accept.properties, and helps to override the 
accept header of a browser.
If you want to activate this mechanism, turn on the "UserAgentTunnel" 
attribute of the Application#tunnelService.


best regards,
Thierry Boileau
[1] http://wiki.restlet.org/docs_1.2/207-restlet.html
[2] 
http://www.restlet.org/documentation/2.0/api/org/restlet/service/TunnelService.html
[3] 
http://www.restlet.org/documentation/1.1/api/org/restlet/data/ClientInfo.html#getAgentAttributes()


> Hi guys,
>
> I'm setting up a restlet app at the moment, and I'd like to set it up so that 
> if a user uses a browser to access a resource, he gets given a nicely 
> formatted HTML page, but if he separately asks for XML or JSON he gets a 
> machine parsable response.  Its all working well on Firefox, but I'm having 
> some issues getting it working on Safari 4.
>
> It looks like the problem is the Accept: header that is being sent in by 
> Safari.  Its 
>
> application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>
> This causes the content negotiation process to favor xml as an output over 
> html, as html has a priority of 0.9.  I tried xhtml, which has the same 
> priority as xml, but it looks like it still chooses xml (presumably it is 
> random which response you get if they have the same priority).
>
> Is there a way I can override Safari's preferences?  I know that it is asking 
> to have xml as the highest priority, but frankly I think that is wrong.
>
> Any suggestions that you can give would be appreciated.
>
> Bruce.
>
> ------------------------------------------------------
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364881
>
>

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2364926

Reply via email to