Omaha #3255 Updated Proxy classes to include all java proxy config settings
Change-Id: Id59993de7bc0f8402f2842161bf8ba4bc2532c79 Former-commit-id:0dd6262862
[formerly 6cd596e6ed8826365d0faeab766601f98ece4fca] Former-commit-id:36ef9e7a1a
This commit is contained in:
parent
fff613478c
commit
15b1fb71dd
1 changed files with 13 additions and 42 deletions
|
@ -19,18 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.registry.services;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.cxf.transports.http.configuration.ConnectionType;
|
||||
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
|
||||
|
||||
import com.raytheon.uf.common.comm.ProxyConfiguration;
|
||||
import com.raytheon.uf.common.comm.ProxyUtil;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -43,6 +35,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 6/5/2014 1712 bphillip Initial coding
|
||||
* 6/18/2014 1712 bphillip Updated Proxy configuration
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -50,9 +43,11 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
*/
|
||||
public class RegistryServiceConfiguration {
|
||||
|
||||
/** The logger */
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistryServiceConfiguration.class);
|
||||
/** The name of the receive timeout property */
|
||||
private static final String RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout";
|
||||
|
||||
/** The name of the connect timeout property */
|
||||
private static final String CONNECT_TIMEOUT_PROPERTY = "ebxml-http-connection-timeout";
|
||||
|
||||
/** Default timeout for receiving HTTP data */
|
||||
private static final String DEFAULT_RECEIVE_TIMEOUT = "60000";
|
||||
|
@ -63,9 +58,6 @@ public class RegistryServiceConfiguration {
|
|||
/** The HTTP Communication policy configuration */
|
||||
private HTTPClientPolicy httpClientPolicy;
|
||||
|
||||
/** The proxy configuration */
|
||||
private ProxyConfiguration proxyConfig;
|
||||
|
||||
/**
|
||||
* Gets the HTTP communication policy.
|
||||
*
|
||||
|
@ -82,40 +74,19 @@ public class RegistryServiceConfiguration {
|
|||
* Initializes the HTTP communication policy
|
||||
*/
|
||||
private void initHttpClientPolicy() {
|
||||
initProxyConfiguration();
|
||||
httpClientPolicy = new HTTPClientPolicy();
|
||||
httpClientPolicy.setReceiveTimeout(Long.parseLong(System.getProperty(
|
||||
"ebxml-http-receive-timeout", DEFAULT_RECEIVE_TIMEOUT)));
|
||||
RECEIVE_TIMEOUT_PROPERTY, DEFAULT_RECEIVE_TIMEOUT)));
|
||||
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
|
||||
.getProperty("ebxml-http-connection-timeout",
|
||||
.getProperty(CONNECT_TIMEOUT_PROPERTY,
|
||||
DEFAULT_CONNECT_TIMEOUT)));
|
||||
|
||||
httpClientPolicy.setConnection(ConnectionType.CLOSE);
|
||||
httpClientPolicy.setMaxRetransmits(5);
|
||||
if (proxyConfig != null) {
|
||||
httpClientPolicy.setProxyServer(proxyConfig.getHost());
|
||||
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
|
||||
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the proxy configuration
|
||||
*
|
||||
* @return The proxy configuration
|
||||
*/
|
||||
private void initProxyConfiguration() {
|
||||
if (proxyConfig == null) {
|
||||
File proxyFile = PathManagerFactory.getPathManager().getStaticFile(
|
||||
"datadelivery" + File.separator + "proxy.properties");
|
||||
if (proxyFile != null) {
|
||||
try {
|
||||
proxyConfig = ProxyUtil.getProxySettings(proxyFile);
|
||||
} catch (IOException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error reading proxy properties", e);
|
||||
}
|
||||
}
|
||||
if (ProxyConfiguration.HTTPS_PROXY_DEFINED) {
|
||||
httpClientPolicy.setProxyServer(ProxyConfiguration.getHttpsProxyHost());
|
||||
httpClientPolicy.setProxyServerPort(ProxyConfiguration.getHttpsProxyPort());
|
||||
httpClientPolicy.setNonProxyHosts(ProxyConfiguration.getHttpsNonProxyHosts());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue