List of usage examples for org.apache.http.params HttpProtocolParams getVersion
public static ProtocolVersion getVersion(HttpParams httpParams)
From source file:priv.test.wechat.HttpRequestBase.java
public ProtocolVersion getProtocolVersion() { return version != null ? version : HttpProtocolParams.getVersion(getParams()); }
From source file:com.google.api.client.http.apache.ApacheHttpTransportTest.java
private void checkHttpClient(HttpClient client) { HttpParams params = client.getParams(); assertFalse(params.getBooleanParameter(ClientPNames.HANDLE_REDIRECTS, true)); assertEquals(HttpVersion.HTTP_1_1, HttpProtocolParams.getVersion(params)); }
From source file:com.grendelscan.commons.http.apache_overrides.client.CustomClientRequestDirector.java
/** * Creates the CONNECT request for tunnelling. * Called by {@link #createTunnelToTarget createTunnelToTarget}. * //from w w w. j a va2 s. c o m * @param route * the route to establish * @param context * the context for request execution * * @return the CONNECT request for tunnelling */ private HttpRequest createConnectRequest(HttpRoute route) { // see RFC 2817, section 5.2 and // INTERNET-DRAFT: Tunneling TCP based protocols through // Web proxy servers HttpHost target = route.getTargetHost(); String host = target.getHostName(); int port = target.getPort(); if (port < 0) { Scheme scheme = connManager.getSchemeRegistry().getScheme(target.getSchemeName()); port = scheme.getDefaultPort(); } StringBuilder buffer = new StringBuilder(host.length() + 6); buffer.append(host); buffer.append(':'); buffer.append(Integer.toString(port)); String authority = buffer.toString(); ProtocolVersion ver = HttpProtocolParams.getVersion(params); HttpRequest req = new BasicHttpRequest("CONNECT", authority, ver); return req; }
From source file:org.robolectric.shadows.httpclient.DefaultRequestDirector.java
/** * Creates the CONNECT request for tunnelling. * Called by {@link #createTunnelToTarget createTunnelToTarget}. * * @param route the route to establish * @param context the context for request execution * * @return the CONNECT request for tunnelling *//*from www.j a va 2 s .c o m*/ protected HttpRequest createConnectRequest(HttpRoute route, HttpContext context) { // see RFC 2817, section 5.2 and // INTERNET-DRAFT: Tunneling TCP based protocols through // Web proxy servers HttpHost target = route.getTargetHost(); String host = target.getHostName(); int port = target.getPort(); if (port < 0) { Scheme scheme = connManager.getSchemeRegistry().getScheme(target.getSchemeName()); port = scheme.getDefaultPort(); } StringBuilder buffer = new StringBuilder(host.length() + 6); buffer.append(host); buffer.append(':'); buffer.append(Integer.toString(port)); String authority = buffer.toString(); ProtocolVersion ver = HttpProtocolParams.getVersion(params); HttpRequest req = new BasicHttpRequest("CONNECT", authority, ver); return req; }
From source file:org.apache.http.impl.client.DefaultRequestDirector.java
/** * Creates the CONNECT request for tunnelling. * Called by {@link #createTunnelToTarget createTunnelToTarget}. * * @param route the route to establish * @param context the context for request execution * * @return the CONNECT request for tunnelling *//*from ww w . j a va 2 s. co m*/ protected HttpRequest createConnectRequest(final HttpRoute route, final HttpContext context) { // see RFC 2817, section 5.2 and // INTERNET-DRAFT: Tunneling TCP based protocols through // Web proxy servers final HttpHost target = route.getTargetHost(); final String host = target.getHostName(); int port = target.getPort(); if (port < 0) { final Scheme scheme = connManager.getSchemeRegistry().getScheme(target.getSchemeName()); port = scheme.getDefaultPort(); } final StringBuilder buffer = new StringBuilder(host.length() + 6); buffer.append(host); buffer.append(':'); buffer.append(Integer.toString(port)); final String authority = buffer.toString(); final ProtocolVersion ver = HttpProtocolParams.getVersion(params); final HttpRequest req = new BasicHttpRequest("CONNECT", authority, ver); return req; }
From source file:org.apache.http.impl.nio.client.DefaultAsyncRequestDirector.java
private HttpRequest createConnectRequest(final HttpRoute route) { // see RFC 2817, section 5.2 and // INTERNET-DRAFT: Tunneling TCP based protocols through // Web proxy servers final HttpHost target = route.getTargetHost(); final String host = target.getHostName(); int port = target.getPort(); if (port < 0) { final AsyncSchemeRegistry registry = getSchemeRegistry(this.localContext); final AsyncScheme scheme = registry.getScheme(target.getSchemeName()); port = scheme.getDefaultPort();/* w w w .j av a2 s . c o m*/ } final StringBuilder buffer = new StringBuilder(host.length() + 6); buffer.append(host); buffer.append(':'); buffer.append(Integer.toString(port)); final ProtocolVersion ver = HttpProtocolParams.getVersion(this.params); final HttpRequest req = new BasicHttpRequest("CONNECT", buffer.toString(), ver); return req; }