看一下client.post(null, url, entity, "application/json", responseHandler);
如下声明方法,您将获得状态码
RestClientAvaal.post(url, entity, new BaseJsonHttpResponseHandler<>() {
@Override
public void onSuccess(int statusCode, Header[] headers, String rawJsonResponse, Object response) {
}
@Override
public void onFailure(int statusCode, Header[] headers, Throwable throwable, String rawJsonData, Object errorResponse) {
}
@Override
protected Object parseResponse(String rawJsonData, boolean isFailure) throws Throwable {
return null;
}
});
如果您想获取异常消息,请在 onFailure 方法中尝试new Exception(throwable).getMessage()