Class URLConnectionOptions
java.lang.Object
org.apache.commons.configuration2.io.URLConnectionOptions
Carries options and operates on
URLConnection.- Since:
- 2.8.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanTells if user interaction, sicj as displaying an authentication dialog, is allowed.private intThe connect timeout in milliseconds.static final URLConnectionOptionsDefault options.private intThe read timeout in milliseconds.private booleanTells if the connection should use caches. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new default instance.URLConnectionOptions(URLConnectionOptions urlConnectionOptions) Constructs an instance with values from the given URLConnectionOptions. -
Method Summary
Modifier and TypeMethodDescriptionapply(URLConnection urlConnection) Applies the options to the given connection.booleanbooleanGets whether to allow user interaction.intGets the connect timeout.intGets the read timeout.booleanGets whether to cache.inthashCode()openConnection(URL url) Opens a connection for the given URL with our options.setAllowUserInteraction(boolean allowUserInteraction) setConnectTimeoutMillis(int connectTimeoutMillis) setReadTimeoutMillis(int readTimeoutMillis) setUseCaches(boolean useCaches) toString()
-
Field Details
-
DEFAULT
Default options. -
allowUserInteraction
private boolean allowUserInteractionTells if user interaction, sicj as displaying an authentication dialog, is allowed. -
connectTimeoutMillis
private int connectTimeoutMillisThe connect timeout in milliseconds. -
readTimeoutMillis
private int readTimeoutMillisThe read timeout in milliseconds. -
useCaches
private boolean useCachesTells if the connection should use caches.
-
-
Constructor Details
-
URLConnectionOptions
public URLConnectionOptions()Constructs a new default instance. -
URLConnectionOptions
Constructs an instance with values from the given URLConnectionOptions.- Parameters:
urlConnectionOptions- the source
-
-
Method Details
-
apply
Applies the options to the given connection.- Parameters:
urlConnection- the target connection.- Returns:
- the given connection.
-
equals
-
getAllowUserInteraction
public boolean getAllowUserInteraction()Gets whether to allow user interaction.- Returns:
- whether to allow user interaction.
-
getConnectTimeoutMillis
public int getConnectTimeoutMillis()Gets the connect timeout.- Returns:
- the connect timeout.
-
getReadTimeoutMillis
public int getReadTimeoutMillis()Gets the read timeout.- Returns:
- the read timeout.
-
getUseCaches
public boolean getUseCaches()Gets whether to cache.- Returns:
- Whether to cache.
-
hashCode
public int hashCode() -
openConnection
Opens a connection for the given URL with our options.- Parameters:
url- the URL to open- Returns:
- A new connection
- Throws:
IOException- if an I/O exception occurs.
-
setAllowUserInteraction
-
setConnectTimeoutMillis
-
setReadTimeoutMillis
-
setUseCaches
-
toString
-