org.openmdx.kernel.url.protocol
Class AbstractURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.openmdx.kernel.url.protocol.AbstractURLConnection
Direct Known Subclasses:
ResourceURLConnection, ResourceURLConnection

public abstract class AbstractURLConnection
extends URLConnection

An delegating URLConnection support class.

Version:
$Revision: 1.2 $
Author:
Jason Dillon

Field Summary
protected  URLConnection delegate
          The delegate URLConnection
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
protected AbstractURLConnection(URL url)
          Constructor
 
Method Summary
 void addRequestProperty(String key, String value)
           
 void connect()
           
 boolean equals(Object obj)
           
 boolean getAllowUserInteraction()
           
 Object getContent()
           
 Object getContent(Class[] classes)
           
 String getContentEncoding()
           
 int getContentLength()
           
 String getContentType()
           
 long getDate()
           
 boolean getDefaultUseCaches()
           
 boolean getDoInput()
           
 boolean getDoOutput()
           
 long getExpiration()
           
 String getHeaderField(int n)
           
 String getHeaderField(String name)
           
 long getHeaderFieldDate(String name, long Default)
           
 int getHeaderFieldInt(String name, int Default)
           
 String getHeaderFieldKey(int n)
           
 Map getHeaderFields()
           
 long getIfModifiedSince()
           
 InputStream getInputStream()
           
 long getLastModified()
           
 OutputStream getOutputStream()
           
 Permission getPermission()
           
 Map getRequestProperties()
           
 String getRequestProperty(String key)
           
 URL getURL()
           
 boolean getUseCaches()
           
 int hashCode()
           
protected abstract  URL makeDelegateUrl(URL url)
          This method must be by a subclass.
protected  URLConnection makeDelegateUrlConnection(URL url)
          This method may be overridden by a subclass.
 void setAllowUserInteraction(boolean allowuserinteraction)
           
 void setDefaultUseCaches(boolean defaultusecaches)
           
 void setDoInput(boolean doinput)
           
 void setDoOutput(boolean dooutput)
           
 void setIfModifiedSince(long ifmodifiedsince)
           
 void setRequestProperty(String key, String value)
           
 void setUseCaches(boolean usecaches)
           
 String toString()
           
 
Methods inherited from class java.net.URLConnection
getConnectTimeout, getDefaultAllowUserInteraction, getDefaultRequestProperty, getFileNameMap, getReadTimeout, guessContentTypeFromName, guessContentTypeFromStream, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setFileNameMap, setReadTimeout
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

delegate

protected final URLConnection delegate
The delegate URLConnection

Constructor Detail

AbstractURLConnection

protected AbstractURLConnection(URL url)
                         throws MalformedURLException,
                                IOException
Constructor

Parameters:
url -
Throws:
MalformedURLException
IOException
Method Detail

makeDelegateUrl

protected abstract URL makeDelegateUrl(URL url)
                                throws IOException
This method must be by a subclass.

Parameters:
url -
Returns:
the delegate URL
Throws:
MalformedURLException
IOException

makeDelegateUrlConnection

protected URLConnection makeDelegateUrlConnection(URL url)
                                           throws IOException
This method may be overridden by a subclass.

Parameters:
url - the delegate connection's URL
Returns:
the delegate URLConnection
Throws:
IOException

toString

public String toString()
Overrides:
toString in class URLConnection

addRequestProperty

public void addRequestProperty(String key,
                               String value)
Overrides:
addRequestProperty in class URLConnection
Parameters:
key -
value -
See Also:
URLConnection.addRequestProperty(java.lang.String, java.lang.String)

connect

public void connect()
             throws IOException
Specified by:
connect in class URLConnection
Throws:
IOException
See Also:
URLConnection.connect()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
Parameters:
obj -
Returns:
See Also:
Object.equals(java.lang.Object)

getAllowUserInteraction

public boolean getAllowUserInteraction()
Overrides:
getAllowUserInteraction in class URLConnection
Returns:
See Also:
URLConnection.getAllowUserInteraction()

getContent

public Object getContent()
                  throws IOException
Overrides:
getContent in class URLConnection
Returns:
Throws:
IOException
See Also:
URLConnection.getContent()

getContent

public Object getContent(Class[] classes)
                  throws IOException
Overrides:
getContent in class URLConnection
Parameters:
classes -
Returns:
Throws:
IOException
See Also:
URLConnection.getContent(java.lang.Class[])

getContentEncoding

public String getContentEncoding()
Overrides:
getContentEncoding in class URLConnection
Returns:
See Also:
URLConnection.getContentEncoding()

getContentLength

public int getContentLength()
Overrides:
getContentLength in class URLConnection
Returns:
See Also:
URLConnection.getContentLength()

getContentType

public String getContentType()
Overrides:
getContentType in class URLConnection
Returns:
See Also:
URLConnection.getContentType()

getDate

public long getDate()
Overrides:
getDate in class URLConnection
Returns:
See Also:
URLConnection.getDate()

getDefaultUseCaches

public boolean getDefaultUseCaches()
Overrides:
getDefaultUseCaches in class URLConnection
Returns:
See Also:
URLConnection.getDefaultUseCaches()

getDoInput

public boolean getDoInput()
Overrides:
getDoInput in class URLConnection
Returns:
See Also:
URLConnection.getDoInput()

getDoOutput

public boolean getDoOutput()
Overrides:
getDoOutput in class URLConnection
Returns:
See Also:
URLConnection.getDoOutput()

getExpiration

public long getExpiration()
Overrides:
getExpiration in class URLConnection
Returns:
See Also:
URLConnection.getExpiration()

getHeaderField

public String getHeaderField(int n)
Overrides:
getHeaderField in class URLConnection
Parameters:
n -
Returns:
See Also:
URLConnection.getHeaderField(int)

getHeaderField

public String getHeaderField(String name)
Overrides:
getHeaderField in class URLConnection
Parameters:
name -
Returns:
See Also:
URLConnection.getHeaderField(java.lang.String)

getHeaderFieldDate

public long getHeaderFieldDate(String name,
                               long Default)
Overrides:
getHeaderFieldDate in class URLConnection
Parameters:
name -
Default -
Returns:
See Also:
URLConnection.getHeaderFieldDate(java.lang.String, long)

getHeaderFieldInt

public int getHeaderFieldInt(String name,
                             int Default)
Overrides:
getHeaderFieldInt in class URLConnection
Parameters:
name -
Default -
Returns:
See Also:
URLConnection.getHeaderFieldInt(java.lang.String, int)

getHeaderFieldKey

public String getHeaderFieldKey(int n)
Overrides:
getHeaderFieldKey in class URLConnection
Parameters:
n -
Returns:
See Also:
URLConnection.getHeaderFieldKey(int)

getHeaderFields

public Map getHeaderFields()
Overrides:
getHeaderFields in class URLConnection
Returns:
See Also:
URLConnection.getHeaderFields()

getIfModifiedSince

public long getIfModifiedSince()
Overrides:
getIfModifiedSince in class URLConnection
Returns:
See Also:
URLConnection.getIfModifiedSince()

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class URLConnection
Returns:
Throws:
IOException
See Also:
URLConnection.getInputStream()

getLastModified

public long getLastModified()
Overrides:
getLastModified in class URLConnection
Returns:
See Also:
URLConnection.getLastModified()

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Overrides:
getOutputStream in class URLConnection
Returns:
Throws:
IOException
See Also:
URLConnection.getOutputStream()

getPermission

public Permission getPermission()
                         throws IOException
Overrides:
getPermission in class URLConnection
Returns:
Throws:
IOException
See Also:
URLConnection.getPermission()

getRequestProperties

public Map getRequestProperties()
Overrides:
getRequestProperties in class URLConnection
Returns:
See Also:
URLConnection.getRequestProperties()

getRequestProperty

public String getRequestProperty(String key)
Overrides:
getRequestProperty in class URLConnection
Parameters:
key -
Returns:
See Also:
URLConnection.getRequestProperty(java.lang.String)

getURL

public URL getURL()
Overrides:
getURL in class URLConnection
Returns:
See Also:
URLConnection.getURL()

getUseCaches

public boolean getUseCaches()
Overrides:
getUseCaches in class URLConnection
Returns:
See Also:
URLConnection.getUseCaches()

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
See Also:
Object.hashCode()

setAllowUserInteraction

public void setAllowUserInteraction(boolean allowuserinteraction)
Overrides:
setAllowUserInteraction in class URLConnection
Parameters:
allowuserinteraction -
See Also:
URLConnection.setAllowUserInteraction(boolean)

setDefaultUseCaches

public void setDefaultUseCaches(boolean defaultusecaches)
Overrides:
setDefaultUseCaches in class URLConnection
Parameters:
defaultusecaches -
See Also:
URLConnection.setDefaultUseCaches(boolean)

setDoInput

public void setDoInput(boolean doinput)
Overrides:
setDoInput in class URLConnection
Parameters:
doinput -
See Also:
URLConnection.setDoInput(boolean)

setDoOutput

public void setDoOutput(boolean dooutput)
Overrides:
setDoOutput in class URLConnection
Parameters:
dooutput -
See Also:
URLConnection.setDoOutput(boolean)

setIfModifiedSince

public void setIfModifiedSince(long ifmodifiedsince)
Overrides:
setIfModifiedSince in class URLConnection
Parameters:
ifmodifiedsince -
See Also:
URLConnection.setIfModifiedSince(long)

setRequestProperty

public void setRequestProperty(String key,
                               String value)
Overrides:
setRequestProperty in class URLConnection
Parameters:
key -
value -
See Also:
URLConnection.setRequestProperty(java.lang.String, java.lang.String)

setUseCaches

public void setUseCaches(boolean usecaches)
Overrides:
setUseCaches in class URLConnection
Parameters:
usecaches -
See Also:
URLConnection.setUseCaches(boolean)


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.