com.sun.jini.jeri.internal.http
Class HttpSettings

java.lang.Object
  extended by com.sun.jini.jeri.internal.http.HttpSettings

public class HttpSettings
extends Object

Utility class for querying HTTP/HTTPS-related system properties.

Author:
Sun Microsystems, Inc.

Field Summary
private static String lastNonProxyHosts
           
private static Object lastNonProxyLock
           
private static SoftReference lastNonProxyPatterns
           
private  Properties props
           
private  boolean ssl
           
 
Constructor Summary
private HttpSettings(boolean ssl, Properties props)
          Creates new HttpSettings instance which returns values from the given system properties list.
 
Method Summary
private static String convertToRegex(String hostPattern)
          Converts host pattern obtained from http.nonProxyHosts property to java.util.regex-style regular expression.
 long getConnectionTimeout()
          Returns com.sun.jini.jeri.http[s].idleConnectionTimeout system property value if set; otherwise returns 15000.
 boolean getDisableProxyPersistentConnections()
          Returns com.sun.jini.jeri.http.disableProxyPersistentConnections system property as boolean value if set and not ssl; otherwise returns false.
static HttpSettings getHttpSettings(boolean ssl)
          Returns an HttpSettings instance which can be used to query values of HTTP-related (if ssl is false) or HTTPS-related (if ssl is true) system properties.
 boolean getPingProxyConnections()
          Returns com.sun.jini.jeri.http.pingProxyConnections system property as boolean value if set; otherwise returns false.
 long getPingProxyConnectionTimeout()
          Returns com.sun.jini.jeri.http.pingProxyConnectionTimeout system property as long value if set; otherwise returns Long.MAX_VALUE (essentially, never timeout).
 String getProxyHost(String host)
          Returns proxy host if given host should be proxied through it, else empty string.
 int getProxyPort()
          Returns http[s].proxyPort system property value if set; else if not ssl returns proxyPort system property value if set; else returns 443 (if ssl) or 80 (if not ssl).
 long getResponseAckTimeout()
          Returns com.sun.jini.jeri.http[s].responseAckTimeout system property value if set; otherwise returns 15000.
 long getServerConnectionTimeout()
          Returns com.sun.jini.jeri.http[s].idleServerConnectionTimeout system property value if set; otherwise returns getConnectionTimeout() plus 30000 (if ssl) or 10000 (if not ssl).
private  boolean nonProxied(String host)
          If http.nonProxyHosts system property value is set, returns true iff given host matches any regular expressions contained in value; if http.nonProxyHosts is unset, returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastNonProxyLock

private static final Object lastNonProxyLock

lastNonProxyHosts

private static String lastNonProxyHosts

lastNonProxyPatterns

private static SoftReference lastNonProxyPatterns

ssl

private final boolean ssl

props

private final Properties props
Constructor Detail

HttpSettings

private HttpSettings(boolean ssl,
                     Properties props)
Creates new HttpSettings instance which returns values from the given system properties list.

Method Detail

getHttpSettings

public static HttpSettings getHttpSettings(boolean ssl)
Returns an HttpSettings instance which can be used to query values of HTTP-related (if ssl is false) or HTTPS-related (if ssl is true) system properties. Calling this method will cause the checkPropertiesAccess method of the current security manager (if any) to be invoked. The returned HttpSettings instance is not guaranteed to reflect changes to the system properties that occur after the invocation of this method.


getProxyHost

public String getProxyHost(String host)
Returns proxy host if given host should be proxied through it, else empty string. Proxy host is http[s].proxyHost system property value if set; else proxyHost system property value if set and not ssl, else none. Non-proxied hosts given by http.nonProxyHosts system property value if set.


getProxyPort

public int getProxyPort()
Returns http[s].proxyPort system property value if set; else if not ssl returns proxyPort system property value if set; else returns 443 (if ssl) or 80 (if not ssl).


getResponseAckTimeout

public long getResponseAckTimeout()
Returns com.sun.jini.jeri.http[s].responseAckTimeout system property value if set; otherwise returns 15000.


getConnectionTimeout

public long getConnectionTimeout()
Returns com.sun.jini.jeri.http[s].idleConnectionTimeout system property value if set; otherwise returns 15000.


getServerConnectionTimeout

public long getServerConnectionTimeout()
Returns com.sun.jini.jeri.http[s].idleServerConnectionTimeout system property value if set; otherwise returns getConnectionTimeout() plus 30000 (if ssl) or 10000 (if not ssl).


getDisableProxyPersistentConnections

public boolean getDisableProxyPersistentConnections()
Returns com.sun.jini.jeri.http.disableProxyPersistentConnections system property as boolean value if set and not ssl; otherwise returns false.


getPingProxyConnections

public boolean getPingProxyConnections()
Returns com.sun.jini.jeri.http.pingProxyConnections system property as boolean value if set; otherwise returns false.


getPingProxyConnectionTimeout

public long getPingProxyConnectionTimeout()
Returns com.sun.jini.jeri.http.pingProxyConnectionTimeout system property as long value if set; otherwise returns Long.MAX_VALUE (essentially, never timeout).


nonProxied

private boolean nonProxied(String host)
If http.nonProxyHosts system property value is set, returns true iff given host matches any regular expressions contained in value; if http.nonProxyHosts is unset, returns false.


convertToRegex

private static String convertToRegex(String hostPattern)
Converts host pattern obtained from http.nonProxyHosts property to java.util.regex-style regular expression. Throws IllegalArgumentException if given host pattern is invalid.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.