/** * Enables the creation of a proxy configuration using * custom values. * * @param proxyHost the host name of the proxy * @param proxyPort the port of the proxy * @param proxyUser the username for the proxy * @param proxyPassword the password for the proxy * @param nonProxyHosts */ public ProxyConfiguration(String proxyHost, int proxyPort, String proxyUser, String proxyPassword, String nonProxyHosts) { this.proxyHost = proxyHost; this.proxyPort = proxyPort; this.proxyUser = proxyUser; this.proxyPassword = proxyPassword; this.nonProxyPattern = createNonProxyPattern(nonProxyHosts); }
/** * Checks whether a proxy has been configured and the given host is not in * the nonProxyHost list or the nonProxyList is empty. * * @param host * the host to be matched * @return true if the host satifies the above stated condition, otherwise * false. */ public boolean isHostProxyable(String host) { return getProxyHost() != null && getProxyPort() > 0 && (nonProxyPattern == null || !nonProxyPattern.matcher(host) .matches()); }
/** * Checks whether the proxy credentials are valid. * Username and password must be non-null and non-empty to qualify. * * @return true if the credentials are valid, false otherwise */ public boolean hasValidCredentials() { return getProxyUser() != null && !getProxyUser().isEmpty() && getProxyPassword() != null && !getProxyPassword().isEmpty(); }
client.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, wconfig.getSockTimeoutSecs() * 1000); if (proxy.isHostProxyable(host)) { HttpHost proxyHost = new HttpHost(proxy.getProxyHost(), proxy.getProxyPort(), "http"); client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost); if (proxy.hasValidCredentials()) { client.getCredentialsProvider().setCredentials(new AuthScope(proxy.getProxyHost(), proxy.getProxyPort()), new UsernamePasswordCredentials(proxy.getProxyUser(), proxy.getProxyPassword()));
public WebClient(WebClientConfiguration webconfig) { wconfig = webconfig; proxy = new ProxyConfiguration(); cManager = configureConnectionManager(wconfig); }
client.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, wconfig.getSockTimeoutSecs() * 1000); if (proxy.isHostProxyable(host)) { HttpHost proxyHost = new HttpHost(proxy.getProxyHost(), proxy.getProxyPort(), "http"); client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost); if (proxy.hasValidCredentials()) { client.getCredentialsProvider().setCredentials(new AuthScope(proxy.getProxyHost(), proxy.getProxyPort()), new UsernamePasswordCredentials(proxy.getProxyUser(), proxy.getProxyPassword()));
public WebClient(WebClientConfiguration webconfig) { wconfig = webconfig; proxy = new ProxyConfiguration(); cManager = configureConnectionManager(wconfig); }
/** * Checks whether the proxy credentials are valid. * Username and password must be non-null and non-empty to qualify. * * @return true if the credentials are valid, false otherwise */ public boolean hasValidCredentials() { return getProxyUser() != null && !getProxyUser().isEmpty() && getProxyPassword() != null && !getProxyPassword().isEmpty(); }
/** * Checks whether a proxy has been configured and the given host is not in * the nonProxyHost list or the nonProxyList is empty. * * @param host * the host to be matched * @return true if the host satifies the above stated condition, otherwise * false. */ public boolean isHostProxyable(String host) { return getProxyHost() != null && getProxyPort() > 0 && (nonProxyPattern == null || !nonProxyPattern.matcher(host) .matches()); }
/** * Enables the creation of a proxy configuration using * custom values. * * @param proxyHost the host name of the proxy * @param proxyPort the port of the proxy * @param proxyUser the username for the proxy * @param proxyPassword the password for the proxy * @param nonProxyHosts */ public ProxyConfiguration(String proxyHost, int proxyPort, String proxyUser, String proxyPassword, String nonProxyHosts) { this.proxyHost = proxyHost; this.proxyPort = proxyPort; this.proxyUser = proxyUser; this.proxyPassword = proxyPassword; this.nonProxyPattern = createNonProxyPattern(nonProxyHosts); }
public WebClient() { wconfig = new WebClientConfiguration(); proxy = new ProxyConfiguration(); cManager = configureConnectionManager(wconfig); }
/** * Default constructor. * Takes the system provided proxy settings. */ public ProxyConfiguration() { this.proxyHost = System.getProperty("http.proxyHost"); this.proxyPort = Integer.parseInt(System.getProperty("http.proxyPort", "80")); this.proxyUser = System.getProperty("http.proxyUser"); this.proxyPassword = System.getProperty("http.proxyPassword"); this.nonProxyPattern = createNonProxyPattern(System.getProperty("http.nonProxyHosts")); }
public WebClient() { wconfig = new WebClientConfiguration(); proxy = new ProxyConfiguration(); cManager = configureConnectionManager(wconfig); }
/** * Default constructor. * Takes the system provided proxy settings. */ public ProxyConfiguration() { this.proxyHost = System.getProperty("http.proxyHost"); this.proxyPort = Integer.parseInt(System.getProperty("http.proxyPort", "80")); this.proxyUser = System.getProperty("http.proxyUser"); this.proxyPassword = System.getProperty("http.proxyPassword"); this.nonProxyPattern = createNonProxyPattern(System.getProperty("http.nonProxyHosts")); }