Package org.apache.http.client.methods

Examples of org.apache.http.client.methods.HttpHead


            if (method.equals(POST)) {
                httpRequest = new HttpPost(uri);
            } else if (method.equals(PUT)) {
                httpRequest = new HttpPut(uri);
            } else if (method.equals(HEAD)) {
                httpRequest = new HttpHead(uri);
            } else if (method.equals(TRACE)) {
                httpRequest = new HttpTrace(uri);
            } else if (method.equals(OPTIONS)) {
                httpRequest = new HttpOptions(uri);
            } else if (method.equals(DELETE)) {
View Full Code Here


      case GET:
        return new HttpGet(uri);
      case DELETE:
        return new HttpDelete(uri);
      case HEAD:
        return new HttpHead(uri);
      case OPTIONS:
        return new HttpOptions(uri);
      case POST:
        return new HttpPost(uri);
      case PUT:
View Full Code Here

      case GET:
        return new HttpGet(uri);
      case DELETE:
        return new HttpDelete(uri);
      case HEAD:
        return new HttpHead(uri);
      case OPTIONS:
        return new HttpOptions(uri);
      case POST:
        return new HttpPost(uri);
      case PUT:
View Full Code Here

            final HttpResponse response,
            final HttpContext context) throws ProtocolException {
        URI uri = getLocationURI(request, response, context);
        String method = request.getRequestLine().getMethod();
        if (method.equalsIgnoreCase(HttpHead.METHOD_NAME)) {
            return new HttpHead(uri);
        } else {
            return new HttpGet(uri);
        }
    }
View Full Code Here

        HttpUriRequest redirect2 = redirectStrategy.getRedirect(
                new HttpPost("http://localhost/"), response, context2);
        Assert.assertEquals("GET", redirect2.getMethod());
        HttpContext context3 = new BasicHttpContext();
        HttpUriRequest redirect3 = redirectStrategy.getRedirect(
                new HttpHead("http://localhost/"), response, context3);
        Assert.assertEquals("HEAD", redirect3.getMethod());
    }
View Full Code Here

    URI uri = new URI("http://" + firstServer + path);
    HttpRequestBase method = null;
    if ("GET".equals(httpMethod)) {
      method = new HttpGet(uri);
    } else if ("HEAD".equals(httpMethod)) {
      method = new HttpHead(uri);
    } else if ("POST".equals(httpMethod)) {
      method = new HttpPost(uri);
    } else if ("PUT".equals(httpMethod)) {
      method = new HttpPut(uri);
    } else {
View Full Code Here

        super(URI.create(requestURI));
    }

   @Override
    protected HttpUriRequest createRequest(final URI requestURI) {
        return new HttpHead(requestURI);
    }
View Full Code Here

   }
  
   public HttpUriRequest convertToApacheRequest(HttpRequest request) {
      HttpUriRequest apacheRequest;
      if (request.getMethod().equals(HttpMethod.HEAD)) {
         apacheRequest = new HttpHead(request.getEndpoint());
      } else if (request.getMethod().equals(HttpMethod.GET)) {
         apacheRequest = new HttpGet(request.getEndpoint());
      } else if (request.getMethod().equals(HttpMethod.DELETE)) {
         apacheRequest = new HttpDelete(request.getEndpoint());
      } else if (request.getMethod().equals(HttpMethod.PUT)) {
View Full Code Here

    if (method.equals(HttpMethods.DELETE)) {
      requestBase = new HttpDelete(url);
    } else if (method.equals(HttpMethods.GET)) {
      requestBase = new HttpGet(url);
    } else if (method.equals(HttpMethods.HEAD)) {
      requestBase = new HttpHead(url);
    } else if (method.equals(HttpMethods.POST)) {
      requestBase = new HttpPost(url);
    } else if (method.equals(HttpMethods.PUT)) {
      requestBase = new HttpPut(url);
    } else if (method.equals(HttpMethods.TRACE)) {
View Full Code Here

   * java.util.Map)
   */
  @Override
  public Map<String, String> head ( URL url, Map<String, String> newHeaders ) throws Exception
  {
    HttpHead head = new HttpHead(url.toURI());
    setupMethod(head, newHeaders);
    HttpResponse response = execute(head);
    EntityUtils.consumeQuietly(response.getEntity());

    Map<String, String> headers = new HashMap<>();
View Full Code Here

TOP

Related Classes of org.apache.http.client.methods.HttpHead

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.