Hi there,

I am currently having some difficulties to get @Posts with Restlet
Android 2.1-RC1 to use my preferred ("application/json") content
representation.

Let's start with some details: I have the following resource interface:

-- 8< --
  public interface EventResource {

      @Post("json")
      void record(Event event);
  }
-- 8< --

When making a call to the record method...

-- 8< --
  final ClientResource clientResource = new
ClientResource(Constants.API_URL_EVENTS);
  clientResource.setChallengeResponse(ChallengeScheme.HTTP_BASIC, ...);
  final EventResource eventResource = clientResource.wrap(EventResource.class);
  eventResource.record(event);
-- 8< --

...Restlet picks "application/x-java-serialized-object" as the object
representation, which my server does not understand.

I have registered the Jackson extension with Restlet:

-- 8< --
  Engine.getInstance().getRegisteredConverters().add(new JacksonConverter());
-- 8< --

If I clear the list of registered converters before registering the
JacksonConverter, Restlet picks the right representation
(JacksonRepresentation, application/json).

Shouldn't this work automagically without clearing the default
converters due to the @Post annotation's "json" value?

Thanks,
Thilo

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

Reply via email to