com.atlassian.gadgets.util
Class HttpTimeoutsProvider

java.lang.Object
  extended by com.atlassian.gadgets.util.HttpTimeoutsProvider

public final class HttpTimeoutsProvider
extends Object

Utility class for providing standardised timeout values to http params.


Field Summary
static String CONNECTION_TIMEOUT_PROPERTY_KEY
           
static int DEFAULT_CONNECT_TIMEOUT_MS
           
static int DEFAULT_SOCKET_TIMEOUT_MS
           
static String SOCKET_TIMEOUT_PROPERTY_KEY
           
 
Constructor Summary
HttpTimeoutsProvider(com.atlassian.sal.api.ApplicationProperties applicationProperties)
           
 
Method Summary
 int getConnectionTimeout()
          Intended to be used to set connection timeout values when building HTTPParams for used with HTTPClient.
 int getSocketTimeout()
          Intended to be used to set socket timeout values when building HTTPParams for used with HTTPClient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOCKET_TIMEOUT_PROPERTY_KEY

public static final String SOCKET_TIMEOUT_PROPERTY_KEY
See Also:
Constant Field Values

CONNECTION_TIMEOUT_PROPERTY_KEY

public static final String CONNECTION_TIMEOUT_PROPERTY_KEY
See Also:
Constant Field Values

DEFAULT_SOCKET_TIMEOUT_MS

public static final int DEFAULT_SOCKET_TIMEOUT_MS
See Also:
Constant Field Values

DEFAULT_CONNECT_TIMEOUT_MS

public static final int DEFAULT_CONNECT_TIMEOUT_MS
See Also:
Constant Field Values
Constructor Detail

HttpTimeoutsProvider

public HttpTimeoutsProvider(com.atlassian.sal.api.ApplicationProperties applicationProperties)
Method Detail

getConnectionTimeout

public int getConnectionTimeout()
Intended to be used to set connection timeout values when building HTTPParams for used with HTTPClient. Tries to get a system property with {#CONNECTION_TIMEOUT_PROPERTY_KEY}, then an application property and falls back to {#DEFAULT_CONNECT_TIMEOUT_MS}.

Returns:
int to use as connection timeout value

getSocketTimeout

public int getSocketTimeout()
Intended to be used to set socket timeout values when building HTTPParams for used with HTTPClient. Tries to get a system property with {#SOCKET_TIMEOUT_PROPERTY_KEY}, then an application property and falls back to {#DEFAULT_SOCKET_TIMEOUT_MS}.

Returns:
int to use as socket timeout value


Copyright © 2014 Atlassian. All Rights Reserved.