thats a valid question, if one would be building a truly restful service, there 
should be need for a second parameter. 

Most of my calls use one parameter, but I have one Put call, that updates the 
Location of a Collection of Entities, that can not be broken of in seperate 
calls.

@Put
public void storeLocationUpdates(Entity[] entities, Location location);

Sure, I could this use a wrapper class to work around the problem, but I would 
be nicer if I could just pass both parameters.



> 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. <ftw4real at gmail dot com> 
> 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=2972584

Reply via email to