Я отправляю некоторые данные на сервер, который отвечает на 302 Moved Temporarily.
Я хочу, чтобы HttpClient выполнил перенаправление и автоматически GET новое местоположение, так как я считаю, что это поведение по умолчанию HttpClient. Однако я получаю исключение и не следую за перенаправлением: (
Здесь будет рассмотрен соответствующий фрагмент кода, любые идеи:
HttpParams httpParams = new BasicHttpParams();
HttpClientParams.setRedirecting(httpParams, true);
SchemeRegistry schemeRegistry = registerFactories();
ClientConnectionManager clientConnectionManager = new ThreadSafeClientConnManager(httpParams, schemeRegistry);
HttpClient httpClient = new DefaultHttpClient(clientConnectionManager, httpParams)
HttpPost postRequest = new HttpPost(url);
postRequest.setHeader(HTTP.CONTENT_TYPE, contentType);
postRequest.setHeader(ACCEPT, contentType);
if (requestBodyString != null) {
postRequest.setEntity(new StringEntity(requestBodyString));
}
return httpClient.execute(postRequest, responseHandler);