java.lang.Object
java.net.URLConnection
org.bzdev.net.EncapURLConnection
Base class for encapsulating URL connections.
This class stores a URL connection and delegates all the
standard methods for a URL connection to the stored URL
connection.
Subclasses will typically override a few methods, perhaps wrapping them in a doPrivileged block or merely tracing some methods by printing their arguments on an output stream for debugging purposes.
-
Field Summary
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequestProperty(String key, String value) voidconnect()booleanintgetContent(Class[] classes) intlongbooleanbooleanbooleanGet the encapsulated URL ConnectionlonggetHeaderField(int n) getHeaderField(String name) longgetHeaderFieldDate(String name, long Default) intgetHeaderFieldInt(String name, int Default) getHeaderFieldKey(int n) longgetHeaderFieldLong(String name, long Default) longlongintgetRequestProperty(String key) getURL()booleanvoidsetAllowUserInteraction(boolean allowuserinteraction) voidsetConnectTimeout(int timeout) voidsetDefaultUseCaches(boolean defaultusecaches) voidsetDoInput(boolean doinput) voidsetDoOutput(boolean dooutput) voidsetIfModifiedSince(long ifmodifiedsince) voidsetReadTimeout(int timeout) voidsetRequestProperty(String key, String value) voidsetUseCaches(boolean usecaches) toString()Methods inherited from class java.net.URLConnection
getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getFileNameMap, guessContentTypeFromName, guessContentTypeFromStream, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setFileNameMap
-
Constructor Details
-
EncapURLConnection
Constructor.- Parameters:
urlc- the URL connection to encapsulate
-
-
Method Details
-
getEncapsulatedURLConnection
Get the encapsulated URL Connection- Returns:
- the URLConnection passed to the constructor.
-
connect
- Specified by:
connectin classURLConnection- Throws:
IOException
-
setConnectTimeout
public void setConnectTimeout(int timeout) - Overrides:
setConnectTimeoutin classURLConnection
-
getConnectTimeout
public int getConnectTimeout()- Overrides:
getConnectTimeoutin classURLConnection
-
setReadTimeout
public void setReadTimeout(int timeout) - Overrides:
setReadTimeoutin classURLConnection
-
getReadTimeout
public int getReadTimeout()- Overrides:
getReadTimeoutin classURLConnection
-
getURL
- Overrides:
getURLin classURLConnection
-
getContentLength
public int getContentLength()- Overrides:
getContentLengthin classURLConnection
-
getContentLengthLong
public long getContentLengthLong()- Overrides:
getContentLengthLongin classURLConnection
-
getContentType
- Overrides:
getContentTypein classURLConnection
-
getContentEncoding
- Overrides:
getContentEncodingin classURLConnection
-
getExpiration
public long getExpiration()- Overrides:
getExpirationin classURLConnection
-
getLastModified
public long getLastModified()- Overrides:
getLastModifiedin classURLConnection
-
getHeaderField
- Overrides:
getHeaderFieldin classURLConnection
-
getHeaderFields
- Overrides:
getHeaderFieldsin classURLConnection
-
getHeaderFieldInt
- Overrides:
getHeaderFieldIntin classURLConnection
-
getHeaderFieldLong
- Overrides:
getHeaderFieldLongin classURLConnection
-
getHeaderFieldDate
- Overrides:
getHeaderFieldDatein classURLConnection
-
getHeaderFieldKey
- Overrides:
getHeaderFieldKeyin classURLConnection
-
getHeaderField
- Overrides:
getHeaderFieldin classURLConnection
-
getContent
- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getContent
- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getPermission
- Overrides:
getPermissionin classURLConnection- Throws:
IOException
-
getInputStream
- Overrides:
getInputStreamin classURLConnection- Throws:
IOException
-
getOutputStream
- Overrides:
getOutputStreamin classURLConnection- Throws:
IOException
-
toString
- Overrides:
toStringin classURLConnection
-
setDoInput
public void setDoInput(boolean doinput) - Overrides:
setDoInputin classURLConnection
-
getDoInput
public boolean getDoInput()- Overrides:
getDoInputin classURLConnection
-
setDoOutput
public void setDoOutput(boolean dooutput) - Overrides:
setDoOutputin classURLConnection
-
getDoOutput
public boolean getDoOutput()- Overrides:
getDoOutputin classURLConnection
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean allowuserinteraction) - Overrides:
setAllowUserInteractionin classURLConnection
-
getAllowUserInteraction
public boolean getAllowUserInteraction()- Overrides:
getAllowUserInteractionin classURLConnection
-
setUseCaches
public void setUseCaches(boolean usecaches) - Overrides:
setUseCachesin classURLConnection
-
getUseCaches
public boolean getUseCaches()- Overrides:
getUseCachesin classURLConnection
-
setIfModifiedSince
public void setIfModifiedSince(long ifmodifiedsince) - Overrides:
setIfModifiedSincein classURLConnection
-
getIfModifiedSince
public long getIfModifiedSince()- Overrides:
getIfModifiedSincein classURLConnection
-
getDefaultUseCaches
public boolean getDefaultUseCaches()- Overrides:
getDefaultUseCachesin classURLConnection
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean defaultusecaches) - Overrides:
setDefaultUseCachesin classURLConnection
-
setRequestProperty
- Overrides:
setRequestPropertyin classURLConnection
-
addRequestProperty
- Overrides:
addRequestPropertyin classURLConnection
-
getRequestProperty
- Overrides:
getRequestPropertyin classURLConnection
-
getRequestProperties
- Overrides:
getRequestPropertiesin classURLConnection
-