0
私たちはアンドロイドアプリを開発しており、紋章を利用したいと考えています。私たちが使用しているWebサービスは、いくつかの状況では、json形式の追加の応答データを含む不正なリクエストに対して400を返します。成功のためのレスポンスハンドラと、悪いリクエストのエラーハンドラがあります。エラーハンドラで返されたデータを取得することは可能ですか?Crest ErrorHandlerレスポンスデータを取得
エラーハンドラ
public class RestErrorHandler implements ErrorHandler{
@Override
public <T> T handle(Request request, Exception e) throws Exception {
// here we need to check the code returned from the
// web service in case of a bad request
return null;
}
}
不正な要求は、次のようになります、このような古い質問を掘るために申し訳ありません
HTTP/1.1 400 Bad Request
Content-Length: 59
Date: Wed, 08 Feb 2012 15:01:23 GMT
Server: Apache
Set-Cookie: session=A…...
Status: 400
Vary: Accept-Encoding
Connection: close
Content-Type: application/json
{"status":false,"code":"403","message":"wrong credentials"}