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;
|
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.ConnectionType;
|
||||||
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
|
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
|
||||||
|
|
||||||
import com.raytheon.uf.common.comm.ProxyConfiguration;
|
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,16 +35,19 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 6/5/2014 1712 bphillip Initial coding
|
* 6/5/2014 1712 bphillip Initial coding
|
||||||
|
* 6/18/2014 1712 bphillip Updated Proxy configuration
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bphillip
|
* @author bphillip
|
||||||
* @version 1
|
* @version 1
|
||||||
*/
|
*/
|
||||||
public class RegistryServiceConfiguration {
|
public class RegistryServiceConfiguration {
|
||||||
|
|
||||||
/** The logger */
|
/** The name of the receive timeout property */
|
||||||
private static final IUFStatusHandler statusHandler = UFStatus
|
private static final String RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout";
|
||||||
.getHandler(RegistryServiceConfiguration.class);
|
|
||||||
|
/** The name of the connect timeout property */
|
||||||
|
private static final String CONNECT_TIMEOUT_PROPERTY = "ebxml-http-connection-timeout";
|
||||||
|
|
||||||
/** Default timeout for receiving HTTP data */
|
/** Default timeout for receiving HTTP data */
|
||||||
private static final String DEFAULT_RECEIVE_TIMEOUT = "60000";
|
private static final String DEFAULT_RECEIVE_TIMEOUT = "60000";
|
||||||
|
@ -63,9 +58,6 @@ public class RegistryServiceConfiguration {
|
||||||
/** The HTTP Communication policy configuration */
|
/** The HTTP Communication policy configuration */
|
||||||
private HTTPClientPolicy httpClientPolicy;
|
private HTTPClientPolicy httpClientPolicy;
|
||||||
|
|
||||||
/** The proxy configuration */
|
|
||||||
private ProxyConfiguration proxyConfig;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the HTTP communication policy.
|
* Gets the HTTP communication policy.
|
||||||
*
|
*
|
||||||
|
@ -82,40 +74,19 @@ public class RegistryServiceConfiguration {
|
||||||
* Initializes the HTTP communication policy
|
* Initializes the HTTP communication policy
|
||||||
*/
|
*/
|
||||||
private void initHttpClientPolicy() {
|
private void initHttpClientPolicy() {
|
||||||
initProxyConfiguration();
|
|
||||||
httpClientPolicy = new HTTPClientPolicy();
|
httpClientPolicy = new HTTPClientPolicy();
|
||||||
httpClientPolicy.setReceiveTimeout(Long.parseLong(System.getProperty(
|
httpClientPolicy.setReceiveTimeout(Long.parseLong(System.getProperty(
|
||||||
"ebxml-http-receive-timeout", DEFAULT_RECEIVE_TIMEOUT)));
|
RECEIVE_TIMEOUT_PROPERTY, DEFAULT_RECEIVE_TIMEOUT)));
|
||||||
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
|
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
|
||||||
.getProperty("ebxml-http-connection-timeout",
|
.getProperty(CONNECT_TIMEOUT_PROPERTY,
|
||||||
DEFAULT_CONNECT_TIMEOUT)));
|
DEFAULT_CONNECT_TIMEOUT)));
|
||||||
|
|
||||||
httpClientPolicy.setConnection(ConnectionType.CLOSE);
|
httpClientPolicy.setConnection(ConnectionType.CLOSE);
|
||||||
httpClientPolicy.setMaxRetransmits(5);
|
httpClientPolicy.setMaxRetransmits(5);
|
||||||
if (proxyConfig != null) {
|
if (ProxyConfiguration.HTTPS_PROXY_DEFINED) {
|
||||||
httpClientPolicy.setProxyServer(proxyConfig.getHost());
|
httpClientPolicy.setProxyServer(ProxyConfiguration.getHttpsProxyHost());
|
||||||
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
|
httpClientPolicy.setProxyServerPort(ProxyConfiguration.getHttpsProxyPort());
|
||||||
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
|
httpClientPolicy.setNonProxyHosts(ProxyConfiguration.getHttpsNonProxyHosts());
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue