On Thu, Mar 15, 2012 at 1:00 AM, Richard Berger <[email protected]>wrote:
> I am now only using the @Post("java") method to be able to use:
> ClientResource client4 = new ClientResource(someURL);
> CommentsResource commentsResource = client4.wrap(CommentsResource.class);
> Representation representation4 = commentsResource.postJava(comment);
>
> rather than the more generic:
> ClientResource client4 = new ClientResource(someURL);
> Representation representation4 = client4.post(comment);
>
I'm saying you don't need the postJava method at all, even to compile. If
you care and have the time, try this:
@Post("json") Representation postComment(Comment comment);
@Post("form") Representation postCommentForm(Form form);
and make sure the client side has the Jackson and Jackson extension jars on
the classpath.
Btw, I have a nifty converter for the server side that uses Jackson to
deserialize Forms into Java objects; you could use this to shrink your
CommentsResource interface down to a single postComment method. I'll blog
about it.
Side note: I know it's just test code, but if you have a family of
resources rooted at "xxx/", it can be convenient to this code to re-use a
parent client resource:
ClientResource client4 = new ClientResource("xxx/");
CommentsResource commentsResource = client4.getChild("comments/",
CommentsResource.class);
Representation representation4 = commentsResource.postComment(comment);
In any case, it is working for me (in this somewhat roundabout way) - so no
> need to spend any more time in the lotus position. Unless of course, by
> lotus position, you mean in the driver's seat of a Lotus Elise :)
>
More like the driver's seat of a Lotus spreadsheet. :-(
--tim
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2936134