Example usage for org.apache.http.client.methods HttpRequestWrapper setURI

List of usage examples for org.apache.http.client.methods HttpRequestWrapper setURI

Introduction

In this page you can find the example usage for org.apache.http.client.methods HttpRequestWrapper setURI.

Prototype

public void setURI(final URI uri) 

Source Link

Usage

From source file:cn.wanghaomiao.seimi.http.hc.SeimiRedirectStrategy.java

@Override
public HttpUriRequest getRedirect(HttpRequest request, HttpResponse response, HttpContext context)
        throws ProtocolException {
    URI uri = getLocationURI(request, response, context);
    String method = request.getRequestLine().getMethod();
    if (HttpPost.METHOD_NAME.equalsIgnoreCase(method)) {
        try {/*  w  w w  . j a v a 2 s.co m*/
            HttpRequestWrapper httpRequestWrapper = (HttpRequestWrapper) request;
            httpRequestWrapper.setURI(uri);
            httpRequestWrapper.removeHeaders("Content-Length");
            return httpRequestWrapper;
        } catch (Exception e) {
            logger.error("HttpRequestWrapper");
        }
        return new HttpPost(uri);
    } else {
        return new HttpGet(uri);
    }
}

From source file:org.zalando.logbook.httpclient.RequestTest.java

private HttpRequestWrapper wrap(HttpRequest delegate) throws URISyntaxException {
    final HttpHost target = HttpHost.create("localhost");
    final HttpRequestWrapper wrap = HttpRequestWrapper.wrap(delegate, target);
    wrap.setURI(URIUtils.rewriteURIForRoute(URI.create("http://localhost/"), new HttpRoute(target)));
    return wrap;/*from w  ww.j  a va 2s .  com*/
}

From source file:com.teradata.tempto.internal.hadoop.hdfs.SimpleHttpRequestsExecutor.java

private HttpUriRequest appendUsernameToQueryString(HttpUriRequest request) {
    HttpRequestWrapper httpRequestWrapper = HttpRequestWrapper.wrap(request);
    URI originalUri = httpRequestWrapper.getURI();
    URI uriWithUsername = appendUsername(originalUri);
    httpRequestWrapper.setURI(uriWithUsername);
    return httpRequestWrapper;
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public CloseableHttpResponse execute(HttpUriRequest request) throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request);
    adviseRobotsTxt(wrap.getURI());/*w w  w .j  av  a  2  s.  com*/
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap);
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public CloseableHttpResponse execute(HttpUriRequest request, HttpContext context)
        throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request);
    adviseRobotsTxt(wrap.getURI());//from   w  w w . j  a v a 2  s . c  o m
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap, context);
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public <T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler)
        throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request);
    adviseRobotsTxt(wrap.getURI());//from   w  ww .  j a  va 2  s  . com
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap, responseHandler);
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public <T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context)
        throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request);
    adviseRobotsTxt(wrap.getURI());//  www .j ava  2s . co  m
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap, responseHandler, context);
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public CloseableHttpResponse execute(HttpHost target, HttpRequest request)
        throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request, target);
    adviseRobotsTxt(wrap.getURI());/*  w  w  w.  java 2 s  .  c o m*/
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap);
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public CloseableHttpResponse execute(HttpHost target, HttpRequest request, HttpContext context)
        throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request, target);
    adviseRobotsTxt(wrap.getURI());/*from  w  ww.j a v a2 s .  c o m*/
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap, context);
}

From source file:com.esri.geoportal.commons.http.BotsHttpClient.java

@Override
public <T> T execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler)
        throws IOException, ClientProtocolException {
    HttpRequestWrapper wrap = HttpRequestWrapper.wrap(request, target);
    adviseRobotsTxt(wrap.getURI());/*from  ww  w  . jav  a  2 s  .  c om*/
    wrap.setURI(applyPHP(wrap.getURI()));
    return client.execute(wrap, responseHandler);
}