Hi,
I seem to have stumbled across a problem with Client. I am using the
following code to talk to my restlet application
Client client = new Client(Protocol.HTTP);
Response response = client.post(url, objrep);
logger.info("The response from the post is " +
response.getStatus().getName());
If I pass through a dud url I get the following exception
28/05/2007 22:46:58 com.noelios.restlet.http.HttpClientHelper handle
WARNING: Error while handling an HTTP client call:
28/05/2007 22:46:58 com.noelios.restlet.http.HttpClientHelper handle
INFO: Error while handling an HTTP client call
java.lang.IllegalArgumentException: Only HTTP or HTTPS resource URIs are
allowed here
at
com.noelios.restlet.ext.httpclient.HttpMethodCall.<init>(HttpMethodCall.java:121)
at
com.noelios.restlet.ext.httpclient.HttpClientHelper.create(HttpClientHelper.java:148)
at
com.noelios.restlet.http.HttpClientConverter.toSpecific(HttpClientConverter.java:75)
at
com.noelios.restlet.http.HttpClientHelper.handle(HttpClientHelper.java:85)
at org.restlet.Client.handle(Client.java:110)
at org.restlet.Uniform.handle(Uniform.java:97)
at org.restlet.Uniform.post(Uniform.java:165)
at
au.com.observant.ringocore.client.http.HttpRingoCoreClient.post(HttpRingoCoreClient.java:85)
at
au.com.observant.ringocore.dispatcher.service.DispatcherConsumer.run(DispatcherConsumer.java:237)
at java.lang.Thread.run(Thread.java:595)
2007-05-28 22:46:58,269 [Thread-2] INFO - The response from the post is OK
but the response code returned form the post is set to Status.SUCCESS_OK
(200).
The issue is that in the Uniform class the org.restlet.data.Response is
initialized with a status of OK and the IllegalArgumentException at the
top of the stack is not propageted down.
I believe the resolution is to make some changes to
com.noelios.restlet.http.HttpClientHelper.handle
form
HttpClientCall httpCall = getConverter().toSpecific(this, request);
getConverter().commit(httpCall, request, response);
to
HttpClientCall httpCall = getConverter().toSpecific(this, request);
if (httpCall != null) {
getConverter().commit(httpCall, request, response);
} else {
response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
}
but I'm not sure whether i need to make the commit() call even if there
is an error.
Can you pls advice.
cheers
</jima>