Hello Cédric,

using a ClientResource, you can directly use the "get" method.

ClientResource res = new ClientResource(uri); // URI is a parameter that
leads to an XML file on a server
res.setRetryOnError(false);
res.setChallengeResponse(challengeScheme, identifier, new String(secret));
// identifier and secret are some given parameters
res.get().write(System.out); // directly write the returned entity to the
console

If you intend to send content to the remote resource, you simply can't use
the "GET" method aims at get a representation of the state of the target
resource.
You should use POST or PUT, for example:
ClientResource res = new ClientResource(uri); // URI is a parameter that
leads to an XML file on a server
res.setRetryOnError(false);
res.setChallengeResponse(challengeScheme, identifier, new String(secret));
// identifier and secret are some given parameters
res.post(body).write(System.out); // directly write the returned entity to
the console


Best regards,
Thierry Boileau


Hi all,
>
> I'm using an *org.restlet.resource.ClientResource* :
>
> /* this code is the simplified version of the code I use, so that it is
> easier to read */
> ClientResource res = new ClientResource(uri); // URI is a parameter that
> leads to an XML file on a server
> res.setRetryOnError(false);
> res.setMethod(method); // here we do a GET method
> res.getRequest().setEntity(body);
> res.setChallengeResponse(challengeScheme, identifier, new String(secret));
> // identifier and secret are some given parameters
> rep = res.handle();
> Status status = res.getStatus();
>
>
> When I try to get the remote content, the request is sent ... but fails
> after the time out expires.
> *status.isError()* is true with the following status code and message :
>
> *Internal Connector Error (1002) - HTTP 1002 (The calling thread timed out
> while waiting for a response to unblock it.)*
>
>
>
> I tried to get the content from two different servers but I face the same
> exception. Does anyone have an idea of the reason of that problem ?
>
> Do you need more information to help me ? If so, do not hesitate to ask for
> it.
>
>
> Thanks in advance for helping.
>
>
> ---------------------------------------------------
> Cédric VIDREQUIN
>
>

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

Reply via email to