AndroidAnnotations restClient 获取 404 错误的 responsebody

AndroidAnnotations restClient get responsebody of 404 error

我正在执行一个 API 调用,但是 API 发回一个状态代码为 404 的错误。我如何才能得到 API 的响应,以便我可以看到什么准确的错误是?

我得到的错误是:

08-12 09:52:05.977  11040-11221/eu.app W/RestTemplate﹕ POST request for "http://hidden-api-url.com" resulted in 404 (Not Found); invoking error handler
08-12 09:52:09.051  11040-11221/eu.app E/AndroidRuntime﹕ FATAL EXCEPTION: pool-5-thread-3
    Process: eu.app, PID: 11040
    org.springframework.web.client.HttpClientErrorException: 404 Not Found

我找到了解决方案。我捕获了 HttpClientErrorException 并得到了 getResponseBodyAsString(); 的响应。

    try {
        restClient.restCall(data);
    } catch (HttpClientErrorException e) {
        Log.d("Response",e.getResponseBodyAsString());
    }