Hi Philipp,

 

I’m on the same line as Tim on this point, the actual representation that
you will exchange will contain both entities and location, in the same
“XML/JSON document”. So it seems logical to me to have an equivalent
representation POJO that would contain both as well.

 

One area where allowing multiple Java parameter seems necessary is when
dealing with multipart representations which are like a composition of
several individual representations, but that’s a more advanced case IMO.

 

Anyway, if you are not convinced at this point, it’s definitely worth
entering an issue so we can keep thinking about this. It might just being us
being wrong :)

 

Best regards,

Jerome

--

 <http://www.restlet.com/> http://www.restlet.com

 <http://twitter.com/#!/jlouvel> http://twitter.com/#!/jlouvel

 

 

 

De : [email protected] [mailto:[email protected]] De la part de Tim
Peierls
Envoyé : vendredi 22 juin 2012 07:02
À : [email protected]
Objet : Re: Re: Re: Restlet Method Call with multiple parameters?

 

This isn't currently supported in Restlet. You could make a feature request
if you could nail down the behavior precisely. 

 

I don't see what's wrong with defining a type for a collection of entities
with a location. It's a resource in your application, so having a class to
represent it sounds like a very reasonable thing.

 

--tim

On Fri, Jun 22, 2012 at 4:12 AM, Philipp E. <[email protected]> wrote:

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
<http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972
431> &dsMessageId=2972431
> > > >
> >
> > ------------------------------------------------------
> >
> > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447
<http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972
479> &dsMessageId=2972479
> >

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447
<http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2972
584> &dsMessageId=2972584

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

Reply via email to