Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] ECF making rest sync calls and HTTP error status codes and message

Hi all,
sorry if this is not the right mailing list for technical questions but I am a first time user so do not be so mad :)

I am using IRemoteServiceClientContainerAdapter to make a sync rest call like this :
....
IRemoteCallable callable = RestCallableFactory.createCallable(resource, resource, rcp, request.getRequestType(),
            IRestCall.DEFAULT_TIMEOUT);
IRemoteServiceRegistration registration = adapter.registerCallables(new IRemoteCallable[] { callable }, null);
IRemoteService restClientService = adapter.getRemoteService(registration.getReference());
....
Object result = restClientService.callSync(RestCallFactory.createRestCall(resource, request.getBody()));

The problem is that in case of expected server error (HTTP Status is not 200 (OK)) I get RestException with the proper status code and this text :
"Http response not OK.  URL="" responseCode=505"
Restful Server Resource implementation is also mine so I control HTTP response status and messages.
According to http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1
"User agents SHOULD display any included entity to the user"

My question is if there is a way to get the Original Error Message or the so called server's entity containing an explanation of the error situation because no
matter what status codes I use and response messages I set, I always get RestException with this predefined text "Http response not OK"

Thanks in advance for your responses,

Best Regards,
Veselin Vasilev




Back to the top