/** * URI constructor for HttpHost. * * @param uri the URI. */ public HttpHost(final URI uri) throws URIException { this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme())); }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
getMethod = completionService.take().get(); URI uri = getMethod.getURI(); String instance = endpointsToServers.get(uri.getHost() + ":" + uri.getPort()); if (getMethod.getStatusCode() >= 300) { LOGGER.error("Server: {} returned error: {}", instance, getMethod.getStatusCode());
private static String createBaseUri(org.apache.commons.httpclient.URI uri) throws URIException { StringBuilder baseUriBuilder = new StringBuilder(); baseUriBuilder.append(uri.getScheme()).append("://").append(uri.getHost()); if (uri.getPort() != -1) { baseUriBuilder.append(':').append(uri.getPort()); } return baseUriBuilder.toString(); }
public static String getHostName(URI uri) throws URIException { StringBuilder host = new StringBuilder(); String scheme = uri.getScheme().toLowerCase(); host.append(scheme).append("://").append(uri.getHost()); int port = uri.getPort(); if (port != -1 && ((port == 80 && !"http".equals(scheme)) || (port == 443 && !"https".equals(scheme) || (port != 80 && port != 443)))) { host.append(":").append(port); } return host.toString(); }
private String getHostName(URI uri) throws URIException { StringBuilder host = new StringBuilder(); String scheme = uri.getScheme(); if (scheme == null) { scheme = "http"; } else { scheme = scheme.toLowerCase(); } host.append(scheme).append("://").append(uri.getHost()); int port = uri.getPort(); if (port != -1 && ((port == 80 && !"http".equals(scheme)) || (port == 443 && !"https".equals(scheme) || (port != 80 && port != 443)))) { host.append(":").append(port); } return host.toString(); }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
/** * URI constructor for HttpHost. * * @param uri the URI. */ public HttpHost(final URI uri) throws URIException { this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme())); }
@SuppressWarnings("unused") public synchronized void setHost(URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch(URIException e) { throw new IllegalArgumentException(e.toString()); } } }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
/** * URI constructor for HttpHost. * * @param uri the URI. */ public HttpHost(final URI uri) throws URIException { this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme())); }
/** * URI constructor for HttpHost. * * @param uri the URI. */ public HttpHost(final URI uri) throws URIException { this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme())); }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
/** * URI constructor for HttpHost. * * @param uri the URI. */ public HttpHost(final URI uri) throws URIException { this(uri.getHost(), uri.getPort(), Protocol.getProtocol(uri.getScheme())); }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
@SuppressWarnings("unused") public synchronized void setHost(URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch(URIException e) { throw new IllegalArgumentException(e.toString()); } } }
/** * Adds a file seed, with the given file name, at the root of the base URI. * <p> * For example, with base URI as {@code http://example.com/some/path/file.html} and file name as {@code sitemap.xml} it's * added the seed {@code http://example.com/sitemap.xml}. * * @param baseUri the base URI. * @param fileName the file name. */ private void addRootFileSeed(URI baseUri, String fileName) { String seed = buildUri(baseUri.getScheme(), baseUri.getRawHost(), baseUri.getPort(), "/" + fileName); try { this.seedList.add(new URI(seed, true)); } catch (Exception e) { log.warn("Error while creating [" + fileName + "] seed: " + seed, e); } }
@Override public synchronized void setHost(URI uri) { try { setHost(new HttpHost(uri.getHost(), uri.getPort(), getProtocol())); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }; };
/** * Sets the URI of this request header. * * @param uri the new request URI * @throws URIException if an error occurred while setting the request URI */ public void setURI(URI uri) throws URIException { if (uri.getScheme() == null || uri.getScheme().equals("")) { mUri = new URI(HTTP + "://" + getHeader(HOST) + "/" + mUri.toString(), true); } else { mUri = uri; } if (uri.getScheme().equalsIgnoreCase(HTTPS)) { mIsSecure = true; } else { mIsSecure = false; } setHostPort(mUri.getPort()); }
protected void fixClientHost(HttpMethod method) { try { // update client host, workaround for Exchange 2003 mailbox with an Exchange 2007 frontend URI currentUri = method.getURI(); if (currentUri != null && currentUri.getHost() != null && currentUri.getScheme() != null) { httpClient.getHostConfiguration().setHost(currentUri.getHost(), currentUri.getPort(), currentUri.getScheme()); } } catch (URIException e) { LOGGER.warn("Unable to update http client host:" + e.getMessage(), e); } }