suricate wrote:
> 
> I am using Apache Pivot to developp a REST client. I encountered the
> following problem:
> I use a GetQuery method to request a web service. When the resource is not
> found, because the user entered an unknown value for a parameter, the
> server returns a HTTP 404 Not found error. The Query class throw a
> QueryException and the returned value which is normally returned by the
> getResult() method is null. The problem is that I need to read the XML
> body response which provides useful info for the client (example: catalog
> with identifier 22 does not exist).
> 

You can return error information such as this using a response header.


suricate wrote:
> 
> I looked at the source code Query.java and the reason of this behavior is
> the following test starting line 462
> 
> // If the response was anything other than 2xx, throw an exception
> int statusPrefix = status / 100;
> if (statusPrefix != 2) {
>                 throw new QueryException(status, message);
> }
> Do you think that behavior is RESTful ?
> 

Yes. You asked for a resource that does not exist, so the result of the
query is null.


--
View this message in context: 
http://apache-pivot-users.399431.n3.nabble.com/GetQuery-does-not-return-the-response-body-content-tp2919276p2922763.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Reply via email to