users@wadl.java.net

MIME Accept Type override

From: Andrew Glowik <andy.glowik_at_bericotechnologies.com>
Date: Tue, 15 Dec 2009 23:07:49 -0500

Our Restlet resource server APPLICATION_JSON and APPLICATION_XML. A JQuery
client, sets the Accept Type to "*/*, application/xml". So the Restlet
negotiates that APPLICATION_JSON should be returned as expected. However, we
want APPLICATION_XML to be served. The problem is that we are unable to
remove the "*/*" as the first Accept type in JQuery. JQuery seems to tack on
the "*/*" as an Accept Type to every request we send.

Is there an elegant way in Restlet to filter the "*/*" values, e.g. ALL or
APPLICATION_ALL? We can certainly get the Accept Headers in Restlet and
re-arrange the Accept list ourselves to "override" the Restlet negotiation.
We are thinking of filtering, after Restlet negotiation, based on the
User-Agent header for this particular JQuery client, so as not to "break"
the Restlet behaviour for other clients (which is what we expect.)