Ah, makes sense.

But why would you expect to be able to send two parameters in a POST?

--tim

On Thu, Jun 21, 2012 at 11:32 AM, Philipp E. <[email protected]> wrote:

> Hello Tim,
>
> this is a workaround for Android, information about it is available here:
>
> http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/266-restlet.html
>
> > Why do you explicitly clear the list of registered converters and
> > explicitly add the Jackson and XML converters?
> >
> > On Thu, Jun 21, 2012 at 8:30 AM, Philipp E. <ftw4real at gmail dot com>
> wrote:
> >
> > > I've been playing around with Restlet(2.1 rc5) in the last week to get
> an
> > > Android Client to communicate with a Restlet server using Java Objects
> > >
> > > After some quirks I can now send and receive POJO objects successfully,
> > > but it only works if I limit the number of parameters to one.
> > >
> > > When I try so attatch more than one parameter I get a 415 - Unsupported
> > > Media Type Error.
> > >
> > > Restlet Interface:
> > >
> > > public interface ParamTestRessource {
> > >
> > > @Post
> > > public void sendTwoParams(Long foo, String bla);
> > >
> > > }
> > > Client Code:
> > >
> > > Engine.getInstance().getRegisteredConverters().clear();
> > > Engine.getInstance().getRegisteredConverters().add(new
> JacksonConverter());
> > > Engine.getInstance().getRegisteredConverters().add(new XmlConverter());
> > >
> > > ClientResource cr = new ClientResource(serverURI+"paramTest");
> > > ParamTestRessource paramTest = cr.wrap(ParamTestRessource.class);
> > > paramTest.sendTwoParams(foo, bar);
> > > +matching ServerRessource and Route on the server side
> > >
> > > Exception on the Client:
> > >
> > > Unsupported Media Type (415) - Unsupported Media Type
> > > Exception on the Server:
> > >
> > > Unable to convert a [application/json,UTF-8] representation into an
> object
> > > of class java.lang.Long
> > > org.codehaus.jackson.map.JsonMappingException: Can not construct
> instance
> > > of java.lang.Long from String value 'asdf': not a valid Long value
> > >
> > > I also tried using different MIME types(for example @Post("xml"))
> > >
> > > Is there a special Converter I should use ? Or is this simply not
> > > supported in Restlet ?
> > >
> > > I know I can use ClientResource.getRequest().getAttributes().put(key,
> > > value) but thats not what I want.
> > >
> > > Thanks in advance for any help!
> > >
> > > ------------------------------------------------------
> > >
> > >
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972431
> > >
>
> ------------------------------------------------------
>
> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972479
>

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

Reply via email to