Exemplo n.º 1
0
  @Override
  public HttpUriRequest getRedirect(HttpRequest request, HttpResponse response, HttpContext context)
      throws ProtocolException {
    RequestLine line = request.getRequestLine();

    String location = getLocation(request, response, context).toString();
    Log.i(
        TAG,
        "Following redirection: " + line.getMethod() + " " + line.getUri() + " -> " + location);

    return RequestBuilder.copy(request)
        .setUri(location)
        .removeHeaders(
            "Content-Length") // Content-Length will be set again automatically, if required;
        // remove it now to avoid duplicate header
        .build();
  }