Re: Is there a way to get the response code from the annotated ClientResource?

2012-03-23 Thread Richard Berger
Thanks so much - that was exactly what I needed!  RB

--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Is-there-a-way-to-get-the-response-code-from-the-annotated-ClientResource-tp7397618p7398735.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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


Re: Is there a way to get the response code from the annotated ClientResource?

2012-03-23 Thread Tim Peierls
On Fri, Mar 23, 2012 at 12:43 AM, Richard Berger
wrote:

> Given code like the following...
>
> ClientResource commentClient = new ClientResource(...);
> CommentsResource commentsResource
> = commentClient.wrap(CommentsResource.class);
> commentsResource.postCommentForm(form);
>
> is there a way to get the response code from the commentsResource?
> Currently I am using: commentClient.getResponse().getStatus().getCode() -
> but that requires me to
> always have access to both the wrapped ClientResource and
> the ClientResource.  I tried casting commentsResource back to
> ClientResource but that didn't work (and was probably a silly idea - but
> hey, I get pretty excited when my code compiles :) :) ).
>


Not silly! But off in one crucial respect: You need to cast to
*ClientProxy
*, which then has a getClientResource method from which to obtain the
underlying ClientResource.

--tim

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

Is there a way to get the response code from the annotated ClientResource?

2012-03-22 Thread Richard Berger
Given code like the following...

ClientResource commentClient = new ClientResource(...);
CommentsResource commentsResource =
commentClient.wrap(CommentsResource.class);
commentsResource.postCommentForm(form);

is there a way to get the response code from the commentsResource? 
Currently I am using:
commentClient.getResponse().getStatus().getCode() - but that requires me to
always have access to both the wrapped ClientResource and the
ClientResource.  I tried casting commentsResource back to ClientResourc but
that didn't work (and was probably a silly idea - but hey, I get pretty
excited when my code compiles :) :) ).

Thanks!
RB


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Is-there-a-way-to-get-the-response-code-from-the-annotated-ClientResource-tp7397618p7397618.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

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