Package org.faceless.publisher.type
Class URL2ConnectionWrapper
java.lang.Object
org.faceless.publisher.type.URL2ConnectionWrapper
- All Implemented Interfaces:
URL2Connection
A URL2Connection that wraps another URL2Connection, for filtering
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
connect()
Open the network connectionReturn the CallbackHandler set byURL2Connection.setCallbackHandler(javax.security.auth.callback.CallbackHandler)
int
getCode()
Return the response code, the logic for this will depend on the scheme but which ideally should match HTTP Will trigger a connectiongetData()
For URLConnections based around an already existing object (like a Blob), this will return the object, otherwise returns null.Return the InputStream for the response.If this instance wraps aURLConnection
, return that, otherwise return nullGet the URL2Connection passed into the constructorReturn a request header as a Date (if set and a valid date), or null otherwise.final String
getRequestHeader
(String key) Return a previously-set Request headerReturn a modifiable map of the Request headers It's usually preferable to callURL2Connection.getRequestHeader(java.lang.String)
to retrieve a single header, as that handles case folding.Return a response header as a Date if set and a valid date, or null otherwise.final String
getResponseHeader
(String key) Return a response header if set, or null otherwise.Return a modifiable map of the Response headers.getURL()
Get the URL.boolean
Return true if the connection has been madevoid
setCallbackHandler
(CallbackHandler handler) Set the CallbackHandler that should be used for any authorization callbacks required on this connectionvoid
setRequestDateHeader
(String key, Date value) Set a request header as a Date.void
setRequestHeader
(String key, String value) Set a request header.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.faceless.publisher.type.URL2Connection
getIfModifiedSince, getLastModified, getMethod, getRequestInputStream
-
Constructor Details
-
URL2ConnectionWrapper
Create a URL2ConnectionWrapper- Parameters:
parent
- the item to wrap
-
-
Method Details
-
getParent
Get the URL2Connection passed into the constructor -
isConnected
public boolean isConnected()Description copied from interface:URL2Connection
Return true if the connection has been made- Specified by:
isConnected
in interfaceURL2Connection
-
getData
For URLConnections based around an already existing object (like a Blob), this will return the object, otherwise returns null.- Specified by:
getData
in interfaceURL2Connection
-
getCallbackHandler
Description copied from interface:URL2Connection
Return the CallbackHandler set byURL2Connection.setCallbackHandler(javax.security.auth.callback.CallbackHandler)
- Specified by:
getCallbackHandler
in interfaceURL2Connection
-
setCallbackHandler
Description copied from interface:URL2Connection
Set the CallbackHandler that should be used for any authorization callbacks required on this connection- Specified by:
setCallbackHandler
in interfaceURL2Connection
-
getLegacyURLConnection
Description copied from interface:URL2Connection
If this instance wraps aURLConnection
, return that, otherwise return null- Specified by:
getLegacyURLConnection
in interfaceURL2Connection
- Throws:
IOException
-
getURL
Description copied from interface:URL2Connection
Get the URL. Note the origin's ReferrerPolicy is used- Specified by:
getURL
in interfaceURL2Connection
-
getInputStream
Description copied from interface:URL2Connection
Return the InputStream for the response. Will trigger a connection- Specified by:
getInputStream
in interfaceURL2Connection
- Throws:
IOException
-
getResponseHeaders
Description copied from interface:URL2Connection
Return a modifiable map of the Response headers. It's usually preferable to callURL2Connection.getResponseHeader(java.lang.String)
to retrieve a single header, as that handles case folding. Will trigger a connection.- Specified by:
getResponseHeaders
in interfaceURL2Connection
- Throws:
IOException
-
getRequestHeaders
Description copied from interface:URL2Connection
Return a modifiable map of the Request headers It's usually preferable to callURL2Connection.getRequestHeader(java.lang.String)
to retrieve a single header, as that handles case folding.- Specified by:
getRequestHeaders
in interfaceURL2Connection
-
getResponseHeader
Description copied from interface:URL2Connection
Return a response header if set, or null otherwise. If multiple headers, returns the first.- Specified by:
getResponseHeader
in interfaceURL2Connection
- Parameters:
key
- the header name, which is case-insensitive- Throws:
IOException
-
getResponseDateHeader
Description copied from interface:URL2Connection
Return a response header as a Date if set and a valid date, or null otherwise. If multiple headers, returns the first.- Specified by:
getResponseDateHeader
in interfaceURL2Connection
- Parameters:
key
- the header name, which is case-insensitive- Throws:
IOException
-
getRequestHeader
Description copied from interface:URL2Connection
Return a previously-set Request header- Specified by:
getRequestHeader
in interfaceURL2Connection
-
getRequestDateHeader
Description copied from interface:URL2Connection
Return a request header as a Date (if set and a valid date), or null otherwise. If multiple headers, returns the first.- Specified by:
getRequestDateHeader
in interfaceURL2Connection
- Parameters:
key
- the header name, which is case-insensitive
-
setRequestHeader
Description copied from interface:URL2Connection
Set a request header. Replaces all other headers with this name.- Specified by:
setRequestHeader
in interfaceURL2Connection
- Parameters:
key
- the header name, which is case-insensitivevalue
- the value name, or null to remove the header.
-
setRequestDateHeader
Description copied from interface:URL2Connection
Set a request header as a Date.- Specified by:
setRequestDateHeader
in interfaceURL2Connection
- Parameters:
key
- the header name, which is case-insensitivevalue
- the date value
-
getCode
Description copied from interface:URL2Connection
Return the response code, the logic for this will depend on the scheme but which ideally should match HTTP Will trigger a connection- Specified by:
getCode
in interfaceURL2Connection
- Throws:
IOException
-
connect
Description copied from interface:URL2Connection
Open the network connection- Specified by:
connect
in interfaceURL2Connection
- Throws:
IOException
-