com.springsource.util.io
Class JarTransformingURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by com.springsource.util.io.JarTransformingURLConnection

public final class JarTransformingURLConnection
extends java.net.URLConnection

Implementation of URLConnection that transforms JAR files as they are read.

A URL is used to source the real connection for the JAR data, and a JarTransformer is used to customize the exact transformations being performed.

See Also:
JarTransformer

Field Summary
private  boolean ensureManifestIsPresent
           
private  JarTransformer transformer
           
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
JarTransformingURLConnection(java.net.URL url, JarTransformer transformer)
          Creates a new JarTransformingURLConnection that will provide content from the JAR identified by url transformed by transformer.
JarTransformingURLConnection(java.net.URL url, JarTransformer transformer, boolean ensureManifestIsPresent)
          Creates a new JarTransformingURLConnection that will provide content from the JAR identified by url transformed by transformer and that will optionally ensure that a manifest is provided, creating one if necessary.
 
Method Summary
 void connect()
           
 java.io.InputStream getInputStream()
           
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

transformer

private final JarTransformer transformer

ensureManifestIsPresent

private final boolean ensureManifestIsPresent
Constructor Detail

JarTransformingURLConnection

public JarTransformingURLConnection(java.net.URL url,
                                    JarTransformer transformer)
Creates a new JarTransformingURLConnection that will provide content from the JAR identified by url transformed by transformer.

Parameters:
url - the URL of the JAR file.
transformer - the JarTransformer to apply as content is being read.

JarTransformingURLConnection

public JarTransformingURLConnection(java.net.URL url,
                                    JarTransformer transformer,
                                    boolean ensureManifestIsPresent)
Creates a new JarTransformingURLConnection that will provide content from the JAR identified by url transformed by transformer and that will optionally ensure that a manifest is provided, creating one if necessary.

Parameters:
url - the URL of the JAR file.
transformer - the JarTransformer to apply as content is being read.
ensureManifestIsPresent - true if the presence of a MANIFEST.MF should be ensured.
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Overrides:
getInputStream in class java.net.URLConnection
Throws:
java.io.IOException

connect

public void connect()
             throws java.io.IOException
Specified by:
connect in class java.net.URLConnection
Throws:
java.io.IOException