Code example for Header

Methods: getValue

0
    HttpResponse response = client.execute(head);
    int status = response.getStatusLine().getStatusCode();
    if (status == 301 || status == 302) {
      Header redirect = response.getFirstHeader("Location");
      if (redirect != null) {
        String location = redirect.getValue();
        if (location != null) {
          return location;
        } 
      } 
    } 
    return uri;
  } 
 
  private static boolean isRedirector(String uri) {
    for (String redirectorHost : REDIRECTOR_HOSTS) {
      if (uri.startsWith(redirectorHost)) {
        return true; 
      } 
    } 
    return false;