Class URLConnectionOptions
- java.lang.Object
-
- org.apache.commons.configuration2.io.URLConnectionOptions
-
public final class URLConnectionOptions extends java.lang.ObjectCarries options and operates onURLConnection.- Since:
- 2.8.0
-
-
Field Summary
Fields Modifier and Type Field Description static URLConnectionOptionsDEFAULTDefault options.
-
Constructor Summary
Constructors Constructor Description URLConnectionOptions()Constructs a new default instance.URLConnectionOptions(URLConnectionOptions urlConnectionOptions)Constructs an instance with values from the given URLConnectionOptions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.URLConnectionapply(java.net.URLConnection urlConnection)Applies the options to the given connection.booleanequals(java.lang.Object obj)booleangetAllowUserInteraction()Gets whether to allow user interaction.intgetConnectTimeoutMillis()Gets the connect timeout.intgetReadTimeoutMillis()Gets the read timeout.booleangetUseCaches()Whether to cache.inthashCode()java.net.URLConnectionopenConnection(java.net.URL url)Opens a connection for the given URL with our options.URLConnectionOptionssetAllowUserInteraction(boolean allowUserInteraction)URLConnectionOptionssetConnectTimeoutMillis(int connectTimeoutMillis)URLConnectionOptionssetReadTimeoutMillis(int readTimeoutMillis)URLConnectionOptionssetUseCaches(boolean useCaches)java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT
public static final URLConnectionOptions DEFAULT
Default options.
-
-
Constructor Detail
-
URLConnectionOptions
public URLConnectionOptions()
Constructs a new default instance.
-
URLConnectionOptions
public URLConnectionOptions(URLConnectionOptions urlConnectionOptions)
Constructs an instance with values from the given URLConnectionOptions.- Parameters:
urlConnectionOptions- the source
-
-
Method Detail
-
apply
public java.net.URLConnection apply(java.net.URLConnection urlConnection)
Applies the options to the given connection.- Parameters:
urlConnection- the target connection.- Returns:
- the given connection.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
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()
Whether to cache.- Returns:
- Whether to cache.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
openConnection
public java.net.URLConnection openConnection(java.net.URL url) throws java.io.IOExceptionOpens a connection for the given URL with our options.- Parameters:
url- the URL to open- Returns:
- A new connection
- Throws:
java.io.IOException- if an I/O exception occurs.
-
setAllowUserInteraction
public URLConnectionOptions setAllowUserInteraction(boolean allowUserInteraction)
-
setConnectTimeoutMillis
public URLConnectionOptions setConnectTimeoutMillis(int connectTimeoutMillis)
-
setReadTimeoutMillis
public URLConnectionOptions setReadTimeoutMillis(int readTimeoutMillis)
-
setUseCaches
public URLConnectionOptions setUseCaches(boolean useCaches)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-