Example usage for org.apache.http.impl.client RequestWrapper getRequestLine

List of usage examples for org.apache.http.impl.client RequestWrapper getRequestLine

Introduction

In this page you can find the example usage for org.apache.http.impl.client RequestWrapper getRequestLine.

Prototype

public RequestLine getRequestLine() 

Source Link

Usage

From source file:org.robolectric.shadows.httpclient.DefaultRequestDirector.java

protected void rewriteRequestURI(final RequestWrapper request, final HttpRoute route) throws ProtocolException {
    try {/*from   ww w .  ja v  a  2 s. c  o m*/

        URI uri = request.getURI();
        if (route.getProxyHost() != null && !route.isTunnelled()) {
            // Make sure the request URI is absolute
            if (!uri.isAbsolute()) {
                HttpHost target = route.getTargetHost();
                uri = URIUtils.rewriteURI(uri, target);
                request.setURI(uri);
            }
        } else {
            // Make sure the request URI is relative
            if (uri.isAbsolute()) {
                uri = URIUtils.rewriteURI(uri, null);
                request.setURI(uri);
            }
        }

    } catch (URISyntaxException ex) {
        throw new ProtocolException("Invalid URI: " + request.getRequestLine().getUri(), ex);
    }
}

From source file:org.apache.http.impl.client.DefaultRequestDirector.java

protected void rewriteRequestURI(final RequestWrapper request, final HttpRoute route) throws ProtocolException {
    try {/*from   w  w w  .ja v  a  2  s.co m*/

        URI uri = request.getURI();
        if (route.getProxyHost() != null && !route.isTunnelled()) {
            // Make sure the request URI is absolute
            if (!uri.isAbsolute()) {
                final HttpHost target = route.getTargetHost();
                uri = URIUtils.rewriteURI(uri, target, true);
            } else {
                uri = URIUtils.rewriteURI(uri);
            }
        } else {
            // Make sure the request URI is relative
            if (uri.isAbsolute()) {
                uri = URIUtils.rewriteURI(uri, null, true);
            } else {
                uri = URIUtils.rewriteURI(uri);
            }
        }
        request.setURI(uri);

    } catch (final URISyntaxException ex) {
        throw new ProtocolException("Invalid URI: " + request.getRequestLine().getUri(), ex);
    }
}

From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java

protected void rewriteRequestURI(final RequestWrapper request, final HttpRoute route) throws ProtocolException {
    try {//from   ww w . j av  a  2 s .c o m
        URI uri = request.getURI();
        if (route.getProxyHost() != null && !route.isTunnelled()) {
            // Make sure the request URI is absolute
            if (!uri.isAbsolute()) {
                final HttpHost target = route.getTargetHost();
                uri = URIUtils.rewriteURI(uri, target);
                request.setURI(uri);
            }
        } else {
            // Make sure the request URI is relative
            if (uri.isAbsolute()) {
                uri = URIUtils.rewriteURI(uri, null);
                request.setURI(uri);
            }
        }
    } catch (final URISyntaxException ex) {
        throw new ProtocolException("Invalid URI: " + request.getRequestLine().getUri(), ex);
    }
}