Hi Steve,
The Restlet API has extensive support for the "Accept" header. The information is parsed and available via the Request.getClientInfo().getAcceptedMediaTypes() : List> method.
Now, in order to automatically negotiate content for you, the Restlet engine needs to have information about the available variants. This is the purpose org.restlet.resource.Resource class in Restlet 1.1 and the new org.restlet.resource.ServerResource class in the Restlet 2.0 version being developed.
In Restlet 1.1, you create a subclass of Resource, declare variants like this:
getVariants().add(new Variant(MediaType.TEXT_PLAIN));
getVariants().add(new Variant(MediaType.APPLICATION_XML));
Then override the represent(Variant) method like this:
public Representation represent(Variant){
if(MediaType.TEXT_PLAIN.equals(variant.getMediaType()){
...
else if(...)
...
Best regards,
Jerome
PS: please use our mailing list for future questions and look in the archives:
http://www.restlet.org/community/lists