Examples of HttpHead


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

            } else if (method.equalsIgnoreCase(Method.POST.getName())) {
                this.httpRequest = new HttpPost(requestUri);
            } else if (method.equalsIgnoreCase(Method.PUT.getName())) {
                this.httpRequest = new HttpPut(requestUri);
            } else if (method.equalsIgnoreCase(Method.HEAD.getName())) {
                this.httpRequest = new HttpHead(requestUri);
            } else if (method.equalsIgnoreCase(Method.DELETE.getName())) {
                this.httpRequest = new HttpDelete(requestUri);
            } else if (method.equalsIgnoreCase(Method.OPTIONS.getName())) {
                this.httpRequest = new HttpOptions(requestUri);
            } else if (method.equalsIgnoreCase(Method.TRACE.getName())) {
View Full Code Here

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

    if (Transfer.GET_METHOD.equalsIgnoreCase(method))
      return new HttpGet(url);
    if (Transfer.DELETE_METHOD.equalsIgnoreCase(method))
      return new HttpDelete(url);
    if (Transfer.HEAD_METHOD.equalsIgnoreCase(method))
      return new HttpHead(url);
    throw new IllegalArgumentException("un supported http method: " + method);
  }
View Full Code Here

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

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

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

    public static Request Get(final String uri) {
        return new Request(new HttpGet(uri));
    }

    public static Request Head(final URI uri) {
        return new Request(new HttpHead(uri));
    }
View Full Code Here

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

    public static Request Head(final URI uri) {
        return new Request(new HttpHead(uri));
    }

    public static Request Head(final String uri) {
        return new Request(new HttpHead(uri));
    }
View Full Code Here

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

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

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

        return resp;
    }

    @Test
    public void consumesBodyIfOriginSendsOneInResponseToHEAD() throws Exception {
        final HttpRequestWrapper wrapper = HttpRequestWrapper.wrap(new HttpHead("http://foo.example.com/"));
        final int nbytes = 128;
        final HttpResponse resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        setMinimalResponseHeaders(resp);
        resp.setHeader("Content-Length","" + nbytes);
View Full Code Here

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

        {
            httpRequest = new HttpGet(proxyTargetURL);
        }
        else if (HttpHead.METHOD_NAME.equals(method))
        {
            httpRequest = new HttpHead(proxyTargetURL);
        }
        else if (HttpPost.METHOD_NAME.equals(method))
        {
            httpRequest = new HttpPost(proxyTargetURL);
            long contentLength = NumberUtils.toLong(request.getHeader(HTTP.CONTENT_LEN));
           
            if (contentLength > 0L)
            {
                HttpEntity entity = new InputStreamEntity(request.getInputStream(), contentLength);
                ((HttpPost) httpRequest).setEntity(entity);
            }
        }
        else if (HttpPut.METHOD_NAME.equals(method))
        {
            httpRequest = new HttpPut(proxyTargetURL);
           
            long contentLength = NumberUtils.toLong(request.getHeader(HTTP.CONTENT_LEN));
           
            if (contentLength > 0L)
            {
                HttpEntity entity = new InputStreamEntity(request.getInputStream(), contentLength);
                ((HttpPost) httpRequest).setEntity(entity);
            }
        }
        else if (HttpDelete.METHOD_NAME.equals(method))
        {
            httpRequest = new HttpDelete(proxyTargetURL);
        }
        else if (HttpOptions.METHOD_NAME.equals(method))
        {
            httpRequest = new HttpOptions(proxyTargetURL);
        }
        else if (HttpTrace.METHOD_NAME.equals(method))
        {
            httpRequest = new HttpHead(proxyTargetURL);
        }
        else
        {
            throw new HttpReverseProxyException("Unsupported method: " + method);
        }
View Full Code Here

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

        return httpClient.execute( httpGet, responseHandler );
    }

    private int pingUrl()
    {
        final HttpHead httpHead = new HttpHead( getWebappUrl() );
        try
        {
            final HttpResponse response = httpClient.execute( httpHead );
            return response.getStatusLine().getStatusCode();
        }
        catch ( IOException e )
        {
            logger.debug( "Ignoring exception while pinging URL " + httpHead.getURI(), e );
            return -1;
        }
    }
View Full Code Here

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

            if (method.equals(HTTPConstants.POST)) {
                httpRequest = new HttpPost(uri);
            } else if (method.equals(HTTPConstants.PUT)) {
                httpRequest = new HttpPut(uri);
            } else if (method.equals(HTTPConstants.HEAD)) {
                httpRequest = new HttpHead(uri);
            } else if (method.equals(HTTPConstants.TRACE)) {
                httpRequest = new HttpTrace(uri);
            } else if (method.equals(HTTPConstants.OPTIONS)) {
                httpRequest = new HttpOptions(uri);
            } else if (method.equals(HTTPConstants.DELETE)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.