public HttpUriRequest getRedirect( final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { final URI uri = getLocationURI(request, response, context); final String method = request.getRequestLine().getMethod(); if (method.equalsIgnoreCase(HttpHeadHC4.METHOD_NAME)) { return new HttpHeadHC4(uri); } else if (method.equalsIgnoreCase(HttpGetHC4.METHOD_NAME)) { return new HttpGetHC4(uri); } else { final int status = response.getStatusLine().getStatusCode(); if (status == HttpStatus.SC_TEMPORARY_REDIRECT) { return RequestBuilder.copy(request).setUri(uri).build(); } else { return new HttpGetHC4(uri); } } }
private HttpUriRequest constructRequest(Apn contentApn, boolean useProxy) throws IOException { HttpGetHC4 request = new HttpGetHC4(contentApn.getMmsc()); for (Header header : getBaseHeaders()) { request.addHeader(header); } if (useProxy) { HttpHost proxy = new HttpHost(contentApn.getProxy(), contentApn.getPort()); request.setConfig(RequestConfig.custom().setProxy(proxy).build()); } return request; }
@Override protected HttpUriRequest constructRequest(boolean useProxy) throws IOException { HttpGetHC4 request = new HttpGetHC4(apn.getMmsc()); request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"); if (useProxy) { HttpHost proxy = new HttpHost(apn.getProxy(), apn.getPort()); request.setConfig(RequestConfig.custom().setProxy(proxy).build()); } return request; }