org.openmdx.compatibility.kernel.url.protocol.xri
Class ZipURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by java.net.JarURLConnection
          extended by org.openmdx.compatibility.kernel.url.protocol.xri.ZipURLConnection

public class ZipURLConnection
extends JarURLConnection

An delegating URLConnection support class.


Field Summary
protected  JarURLConnection delegateConnection
           
static String JAR_PREFIX
          A derived valu the JAR prefix
static String JAR_PROTOCOL
          The jar protocol
static String JAR_SEPARATOR
          As defined by JarURLConnection.
protected  URL xri
           
 
Fields inherited from class java.net.JarURLConnection
jarFileURLConnection
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
ZipURLConnection(URL xri)
          Constructor
 
Method Summary
 void connect()
           
 boolean getAllowUserInteraction()
           
 Attributes getAttributes()
          Return the Attributes object for this connection if the URL for it points to a JAR file entry, null otherwise.
 Certificate[] getCertificates()
          Return the Certificate object for this connection if the URL for it points to a JAR file entry, null otherwise.
 Object getContent()
           
 Object getContent(Class[] classes)
           
 String getContentEncoding()
           
 int getContentLength()
           
 String getContentType()
           
 long getDate()
           
 boolean getDefaultUseCaches()
           
 boolean getDoInput()
           
 boolean getDoOutput()
           
 String getEntryName()
          Return the entry name for this connection.
 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)
           
 long getIfModifiedSince()
           
 InputStream getInputStream()
           
 JarEntry getJarEntry()
          Return the JAR entry object for this connection, if any.
 JarFile getJarFile()
          Return the JAR file for this connection.
 long getLastModified()
           
 Attributes getMainAttributes()
          Returns the main Attributes for the JAR file for this connection.
 Manifest getManifest()
          Returns the Manifest for this connection, or null if none.
 OutputStream getOutputStream()
           
 Permission getPermission()
           
 String getRequestProperty(String key)
           
 URL getURL()
           
 boolean getUseCaches()
           
 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.JarURLConnection
getJarFileURL
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getConnectTimeout, getDefaultAllowUserInteraction, getDefaultRequestProperty, getFileNameMap, getHeaderFields, getReadTimeout, getRequestProperties, guessContentTypeFromName, guessContentTypeFromStream, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setFileNameMap, setReadTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xri

protected URL xri

delegateConnection

protected JarURLConnection delegateConnection

JAR_SEPARATOR

public static final String JAR_SEPARATOR
As defined by JarURLConnection.

A JAR may be embedded in a ZIP, an EAR, a WAR or a RAR.

See Also:
JarURLConnection, Constant Field Values

JAR_PROTOCOL

public static final String JAR_PROTOCOL
The jar protocol

See Also:
Constant Field Values

JAR_PREFIX

public static final String JAR_PREFIX
A derived valu the JAR prefix

See Also:
Constant Field Values
Constructor Detail

ZipURLConnection

public ZipURLConnection(URL xri)
                 throws IOException
Constructor

Parameters:
xri -
Throws:
IOException
Method Detail

getEntryName

public String getEntryName()
Return the entry name for this connection. This method returns null if the JAR file URL corresponding to this connection points to a JAR file and not a JAR file entry.

Overrides:
getEntryName in class JarURLConnection
Returns:
the entry name for this connection, if any.

getJarFile

public JarFile getJarFile()
                   throws IOException
Return the JAR file for this connection. The returned object is not modifiable, and will throw UnsupportedOperationException if the caller attempts to modify it.

Specified by:
getJarFile in class JarURLConnection
Returns:
the JAR file for this connection. If the connection is a connection to an entry of a JAR file, the JAR file object is returned
Throws:
IOException - if an IOException occurs while trying to connect to the JAR file for this connection.
See Also:
connect()

getManifest

public Manifest getManifest()
                     throws IOException
Returns the Manifest for this connection, or null if none. The returned object is not modifiable, and will throw UnsupportedOperationException if the caller attempts to modify it.

Overrides:
getManifest in class JarURLConnection
Returns:
the manifest object corresponding to the JAR file object for this connection.
Throws:
IOException - if getting the JAR file for this connection causes an IOException to be trown.
See Also:
getJarFile()

getJarEntry

public JarEntry getJarEntry()
                     throws IOException
Return the JAR entry object for this connection, if any. This method returns null if the JAR file URL corresponding to this connection points to a JAR file and not a JAR file entry. The returned object is not modifiable, and will throw UnsupportedOperationException if the caller attempts to modify it.

Overrides:
getJarEntry in class JarURLConnection
Returns:
the JAR entry object for this connection, or null if the JAR URL for this connection points to a JAR file.
Throws:
IOException - if getting the JAR file for this connection causes an IOException to be trown.
See Also:
getJarFile(), getJarEntry()

getAttributes

public Attributes getAttributes()
                         throws IOException
Return the Attributes object for this connection if the URL for it points to a JAR file entry, null otherwise.

Overrides:
getAttributes in class JarURLConnection
Returns:
the Attributes object for this connection if the URL for it points to a JAR file entry, null otherwise.
Throws:
IOException - if getting the JAR entry causes an IOException to be thrown.
See Also:
getJarEntry()

getMainAttributes

public Attributes getMainAttributes()
                             throws IOException
Returns the main Attributes for the JAR file for this connection.

Overrides:
getMainAttributes in class JarURLConnection
Returns:
the main Attributes for the JAR file for this connection.
Throws:
IOException - if getting the manifest causes an IOException to be thrown.
See Also:
getJarFile(), getManifest()

getCertificates

public Certificate[] getCertificates()
                              throws IOException
Return the Certificate object for this connection if the URL for it points to a JAR file entry, null otherwise. This method can only be called once the connection has been completely verified by reading from the input stream until the end of the stream has been reached. Otherwise, this method will return null

Overrides:
getCertificates in class JarURLConnection
Returns:
the Certificate object for this connection if the URL for it points to a JAR file entry, null otherwise.
Throws:
IOException - if getting the JAR entry causes an IOException to be thrown.
See Also:
getJarEntry()

connect

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

getURL

public URL getURL()
Overrides:
getURL in class URLConnection

getContentLength

public int getContentLength()
Overrides:
getContentLength in class URLConnection

getContentType

public String getContentType()
Overrides:
getContentType in class URLConnection

getContentEncoding

public String getContentEncoding()
Overrides:
getContentEncoding in class URLConnection

getExpiration

public long getExpiration()
Overrides:
getExpiration in class URLConnection

getDate

public long getDate()
Overrides:
getDate in class URLConnection

getLastModified

public long getLastModified()
Overrides:
getLastModified in class URLConnection

getHeaderField

public String getHeaderField(String name)
Overrides:
getHeaderField in class URLConnection

getHeaderFieldInt

public int getHeaderFieldInt(String name,
                             int _default)
Overrides:
getHeaderFieldInt in class URLConnection

getHeaderFieldDate

public long getHeaderFieldDate(String name,
                               long _default)
Overrides:
getHeaderFieldDate in class URLConnection

getHeaderFieldKey

public String getHeaderFieldKey(int n)
Overrides:
getHeaderFieldKey in class URLConnection

getHeaderField

public String getHeaderField(int n)
Overrides:
getHeaderField in class URLConnection

getContent

public Object getContent()
                  throws IOException
Overrides:
getContent in class URLConnection
Throws:
IOException

getContent

public Object getContent(Class[] classes)
                  throws IOException
Overrides:
getContent in class URLConnection
Throws:
IOException

getPermission

public Permission getPermission()
                         throws IOException
Overrides:
getPermission in class URLConnection
Throws:
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class URLConnection
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Overrides:
getOutputStream in class URLConnection
Throws:
IOException

toString

public String toString()
Overrides:
toString in class URLConnection

setDoInput

public void setDoInput(boolean doinput)
Overrides:
setDoInput in class URLConnection

getDoInput

public boolean getDoInput()
Overrides:
getDoInput in class URLConnection

setDoOutput

public void setDoOutput(boolean dooutput)
Overrides:
setDoOutput in class URLConnection

getDoOutput

public boolean getDoOutput()
Overrides:
getDoOutput in class URLConnection

setAllowUserInteraction

public void setAllowUserInteraction(boolean allowuserinteraction)
Overrides:
setAllowUserInteraction in class URLConnection

getAllowUserInteraction

public boolean getAllowUserInteraction()
Overrides:
getAllowUserInteraction in class URLConnection

setUseCaches

public void setUseCaches(boolean usecaches)
Overrides:
setUseCaches in class URLConnection

getUseCaches

public boolean getUseCaches()
Overrides:
getUseCaches in class URLConnection

setIfModifiedSince

public void setIfModifiedSince(long ifmodifiedsince)
Overrides:
setIfModifiedSince in class URLConnection

getIfModifiedSince

public long getIfModifiedSince()
Overrides:
getIfModifiedSince in class URLConnection

getDefaultUseCaches

public boolean getDefaultUseCaches()
Overrides:
getDefaultUseCaches in class URLConnection

setDefaultUseCaches

public void setDefaultUseCaches(boolean defaultusecaches)
Overrides:
setDefaultUseCaches in class URLConnection

setRequestProperty

public void setRequestProperty(String key,
                               String value)
Overrides:
setRequestProperty in class URLConnection

getRequestProperty

public String getRequestProperty(String key)
Overrides:
getRequestProperty in class URLConnection


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