Refine search
@Override protected HttpHost determineProxy(HttpHost target, HttpRequest request, HttpContext context) throws HttpException { HttpHost httpHost = super.determineProxy(target, request, context); if (scheme != null && !scheme.equalsIgnoreCase(httpHost.getSchemeName())) { httpHost = new HttpHost(httpHost.getHostName(), httpHost.getPort(), scheme); } return httpHost; } }
public static int extracPort(HttpHost target) { if (target.getPort() > 0) { return target.getPort(); } if (target.getSchemeName().equalsIgnoreCase("http")) { return 80; } else if (target.getSchemeName().equalsIgnoreCase("https")) { return 443; } return target.getPort(); } }
public boolean isApiHost(HttpHost host) { return ("http".equals(host.getSchemeName()) || "https".equals(host.getSchemeName())) && resourceHost.getHostName().equals(host.getHostName()); }
@Override public HttpRoute determineRoute(HttpHost host, HttpRequest request, HttpContext context) throws HttpException { Args.notNull(host, "Target host"); Args.notNull(request, "Request"); final HttpClientContext clientContext = HttpClientContext.adapt(context); final RequestConfig config = clientContext.getRequestConfig(); final InetAddress local = config.getLocalAddress(); HttpHost proxy = config.getProxy(); final HttpHost target; if (host.getPort() > 0 && (host.getSchemeName().equalsIgnoreCase("http") && host.getPort() == 80 || host.getSchemeName().equalsIgnoreCase("https") && host.getPort() == 443)) { target = new HttpHost(host.getHostName(), -1, host.getSchemeName()); } else { target = host; } final boolean secure = target.getSchemeName().equalsIgnoreCase("https"); if (proxy == null) { return new HttpRoute(target, local, secure); } else { return new HttpRoute(target, local, proxy, secure); } }
private static URI hostToUri(HttpHost host) { try { return new URI(host.getSchemeName(), host.getHostName(), null, null); } catch (URISyntaxException ignored) { throw new RuntimeException(); } } }
public int resolve(final HttpHost host) throws UnsupportedSchemeException { Args.notNull(host, "HTTP host"); final int port = host.getPort(); if (port > 0) { return port; } final String name = host.getSchemeName(); if (name.equalsIgnoreCase("http")) { return 80; } else if (name.equalsIgnoreCase("https")) { return 443; } else { throw new UnsupportedSchemeException(name + " protocol is not supported"); } }
String host = target.getHostName(); int port = target.getPort(); if (port < 0) { Scheme scheme = connManager.getSchemeRegistry(). getScheme(target.getSchemeName()); port = scheme.getDefaultPort();
@Override protected HttpHost determineProxy(final HttpHost host, final HttpRequest request, final HttpContext context) throws HttpException { if (noProxyFor(host.getHostName())) { return null; } return proxies.get(host.getSchemeName()); }
public int resolve(final HttpHost host) throws UnsupportedSchemeException { Args.notNull(host, "HTTP host"); final int port = host.getPort(); if (port > 0) { return port; } final String name = host.getSchemeName(); if (name.equalsIgnoreCase("http")) { return 80; } else if (name.equalsIgnoreCase("https")) { return 443; } else { throw new UnsupportedSchemeException(name + " protocol is not supported"); } }
target.getSchemeName(), target.getHostName(), target.getPort(), uri.getRawPath(), uri.getRawQuery(),
@Override protected HttpHost determineProxy( final HttpHost target, final HttpRequest request, final HttpContext context) throws HttpException { if (noProxyFor(target.getHostName())) { return null; } return proxies.get(target.getSchemeName()); }
@Override public int resolve(final HttpHost host) throws UnsupportedSchemeException { Args.notNull(host, "HTTP host"); final int port = host.getPort(); if (port > 0) { return port; } final String name = host.getSchemeName(); if (name.equalsIgnoreCase("http")) { return 80; } else if (name.equalsIgnoreCase("https")) { return 443; } else { throw new UnsupportedSchemeException(name + " protocol is not supported"); } }
String host = target.getHostName(); int port = target.getPort(); if (port < 0) { Scheme scheme = connManager.getSchemeRegistry(). getScheme(target.getSchemeName()); port = scheme.getDefaultPort();
@Override public void upgrade( final ManagedHttpClientConnection conn, final HttpHost host, final HttpContext context) throws IOException { final HttpClientContext clientContext = HttpClientContext.adapt(context); final Lookup<ConnectionSocketFactory> registry = getSocketFactoryRegistry(clientContext); final ConnectionSocketFactory sf = registry.lookup(host.getSchemeName()); if (sf == null) { throw new UnsupportedSchemeException(host.getSchemeName() + " protocol is not supported"); } if (!(sf instanceof LayeredConnectionSocketFactory)) { throw new UnsupportedSchemeException(host.getSchemeName() + " protocol does not support connection upgrade"); } final LayeredConnectionSocketFactory lsf = (LayeredConnectionSocketFactory) sf; Socket sock = conn.getSocket(); final int port = this.schemePortResolver.resolve(host); sock = lsf.createLayeredSocket(sock, host.getHostName(), port, context); conn.bind(sock); }
@Override public int resolve(final HttpHost host) throws UnsupportedSchemeException { Args.notNull(host, "HTTP host"); final int port = host.getPort(); if (port > 0) { return port; } final String name = host.getSchemeName(); if (name.equalsIgnoreCase("http")) { return 80; } else if (name.equalsIgnoreCase("https")) { return 443; } else { throw new UnsupportedSchemeException(name + " protocol is not supported"); } }
final Scheme schm = schemeRegistry.getScheme(target.getSchemeName()); if (!(schm.getSocketFactory() instanceof LayeredSocketFactory)) { throw new IllegalArgumentException try { sock = lsf.createSocket (conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), true); } catch (ConnectException ex) { throw new HttpHostConnectException(target, ex);
public void upgrade( final ManagedHttpClientConnection conn, final HttpHost host, final HttpContext context) throws IOException { final HttpClientContext clientContext = HttpClientContext.adapt(context); final Lookup<ConnectionSocketFactory> registry = getSocketFactoryRegistry(clientContext); final ConnectionSocketFactory sf = registry.lookup(host.getSchemeName()); if (sf == null) { throw new UnsupportedSchemeException(host.getSchemeName() + " protocol is not supported"); } if (!(sf instanceof LayeredConnectionSocketFactory)) { throw new UnsupportedSchemeException(host.getSchemeName() + " protocol does not support connection upgrade"); } final LayeredConnectionSocketFactory lsf = (LayeredConnectionSocketFactory) sf; Socket sock = conn.getSocket(); final int port = this.schemePortResolver.resolve(host); sock = lsf.createLayeredSocket(sock, host.getHostName(), port, context); conn.bind(sock); }
@Override public int resolve(final HttpHost host) throws UnsupportedSchemeException { Args.notNull(host, "HTTP host"); final int port = host.getPort(); if (port > 0) { return port; } final String name = host.getSchemeName(); if (name.equalsIgnoreCase("http")) { return 80; } else if (name.equalsIgnoreCase("https")) { return 443; } else { throw new UnsupportedSchemeException(name + " protocol is not supported"); } }
try { targetUri = new URIBuilder() .setHost(target.getHostName()) .setPort(target.getPort()) .setScheme(target.getSchemeName()) .setPath(configuration.getPath()) .build();
public void upgrade( final ManagedHttpClientConnection conn, final HttpHost host, final HttpContext context) throws IOException { final HttpClientContext clientContext = HttpClientContext.adapt(context); final Lookup<ConnectionSocketFactory> registry = getSocketFactoryRegistry(clientContext); final ConnectionSocketFactory sf = registry.lookup(host.getSchemeName()); if (sf == null) { throw new UnsupportedSchemeException(host.getSchemeName() + " protocol is not supported"); } if (!(sf instanceof LayeredConnectionSocketFactory)) { throw new UnsupportedSchemeException(host.getSchemeName() + " protocol does not support connection upgrade"); } final LayeredConnectionSocketFactory lsf = (LayeredConnectionSocketFactory) sf; Socket sock = conn.getSocket(); final int port = this.schemePortResolver.resolve(host); sock = lsf.createLayeredSocket(sock, host.getHostName(), port, context); conn.bind(sock); }