I was able to restrict the media types that my client was willing to accept by
registering only the converters for the media types I wanted the client to
accept.
List<ConverterHelper> converters = new ArrayList<ConverterHelper>();
converters.add(new OrderingContextConverter(new
XmlOrderingContextDataBinder()));
converters.add(new OrderModificationPlanConverter(new
XmlOrderModificationPlanDataBinder()));
Engine.getInstance().setRegisteredConverters(converters);
Is this the only way to do this? If not, is this the correct approach?
Thanks,
Norm
> I'm using the ClientResource (Restlet 2.0.10) and would like to explicitly
> control the media types that my client will accept. More specifically I only
> want my client to accept "application/xml" but in looking at the code in
> ClientResource.wrap...
>
> // Updates the client preferences
> List<org.restlet.representation.Variant>
> responseVariants = annotation
> .getResponseVariants(getMetadataService(),
> getConverterService());
>
> if (responseVariants != null) {
> request.setClientInfo(new ClientInfo(
> responseVariants));
> }
>
> It looks like it will always override any preferences I set on my ClientInfo
> with whatever the ConvertService is capable of handling. Is there a way
> around this?
>
> Thanks,
>
> Norm
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2884392