org.eclipse.jetty.osgi.boot.warurl.internal
Class WarURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.eclipse.jetty.osgi.boot.warurl.internal.WarURLConnection

public class WarURLConnection
extends URLConnection

Facade for a URLConnection that will read a jar and substitute its manifest by the manifest provided here.

Use Piped streams to avoid having to create temporary files.


Field Summary
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
WarURLConnection(URL url, Manifest mf)
           
 
Method Summary
 void addRequestProperty(String key, String value)
           
 void connect()
           
 boolean equals(Object obj)
           
 boolean getAllowUserInteraction()
           
 int getConnectTimeout()
           
 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<String,List<String>> getHeaderFields()
           
 long getIfModifiedSince()
           
 InputStream getInputStream()
           
 long getLastModified()
           
 OutputStream getOutputStream()
           
 Permission getPermission()
           
 int getReadTimeout()
           
 Map<String,List<String>> getRequestProperties()
           
 String getRequestProperty(String key)
           
 URL getURL()
           
 boolean getUseCaches()
           
 void setAllowUserInteraction(boolean allowuserinteraction)
           
 void setConnectTimeout(int timeout)
           
 void setDefaultUseCaches(boolean defaultusecaches)
           
 void setDoInput(boolean doinput)
           
 void setDoOutput(boolean dooutput)
           
 void setIfModifiedSince(long ifmodifiedsince)
           
 void setReadTimeout(int timeout)
           
 void setRequestProperty(String key, String value)
           
 void setUseCaches(boolean usecaches)
           
static InputStream substitueManifest(Manifest newmanifest, InputStream rawIn)
          Use PipedOuputStream and PipedInputStream to do the transformation without making a new temporary file ust to replace the manifest.
 
Methods inherited from class java.net.URLConnection
getDefaultAllowUserInteraction, getDefaultRequestProperty, getFileNameMap, guessContentTypeFromName, guessContentTypeFromStream, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setFileNameMap, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WarURLConnection

public WarURLConnection(URL url,
                        Manifest mf)
                 throws IOException
Parameters:
url - The file url (for example)
mf - The manifest to use as a replacement to the jar file inside the file url.
Throws:
IOException
Method Detail

substitueManifest

public static InputStream substitueManifest(Manifest newmanifest,
                                            InputStream rawIn)
                                     throws IOException
Use PipedOuputStream and PipedInputStream to do the transformation without making a new temporary file ust to replace the manifest.

Parameters:
newmanifest - The new manifest
rawIn - The file input stream or equivalent. not the jar input stream.
Throws:
IOException

connect

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

getInputStream

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

addRequestProperty

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

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getAllowUserInteraction

public boolean getAllowUserInteraction()
Overrides:
getAllowUserInteraction in class URLConnection

getConnectTimeout

public int getConnectTimeout()
Overrides:
getConnectTimeout 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

getContentEncoding

public String getContentEncoding()
Overrides:
getContentEncoding in class URLConnection

getContentLength

public int getContentLength()
Overrides:
getContentLength in class URLConnection

getContentType

public String getContentType()
Overrides:
getContentType in class URLConnection

getDate

public long getDate()
Overrides:
getDate in class URLConnection

getDefaultUseCaches

public boolean getDefaultUseCaches()
Overrides:
getDefaultUseCaches in class URLConnection

getDoInput

public boolean getDoInput()
Overrides:
getDoInput in class URLConnection

getDoOutput

public boolean getDoOutput()
Overrides:
getDoOutput in class URLConnection

getExpiration

public long getExpiration()
Overrides:
getExpiration in class URLConnection

getHeaderField

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

getHeaderField

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

getHeaderFieldDate

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

getHeaderFieldInt

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

getHeaderFieldKey

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

getHeaderFields

public Map<String,List<String>> getHeaderFields()
Overrides:
getHeaderFields in class URLConnection

getIfModifiedSince

public long getIfModifiedSince()
Overrides:
getIfModifiedSince in class URLConnection

getLastModified

public long getLastModified()
Overrides:
getLastModified in class URLConnection

getOutputStream

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

getPermission

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

getReadTimeout

public int getReadTimeout()
Overrides:
getReadTimeout in class URLConnection

getRequestProperties

public Map<String,List<String>> getRequestProperties()
Overrides:
getRequestProperties in class URLConnection

getRequestProperty

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

getURL

public URL getURL()
Overrides:
getURL in class URLConnection

getUseCaches

public boolean getUseCaches()
Overrides:
getUseCaches in class URLConnection

setAllowUserInteraction

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

setConnectTimeout

public void setConnectTimeout(int timeout)
Overrides:
setConnectTimeout in class URLConnection

setDefaultUseCaches

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

setDoInput

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

setDoOutput

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

setIfModifiedSince

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

setReadTimeout

public void setReadTimeout(int timeout)
Overrides:
setReadTimeout in class URLConnection

setRequestProperty

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

setUseCaches

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


Copyright © 1995-2011 Mort Bay Consulting. All Rights Reserved.