Class WarURLConnection
- java.lang.Object
-
- java.net.URLConnection
-
- org.eclipse.jetty.osgi.boot.warurl.internal.WarURLConnection
-
public class WarURLConnection extends java.net.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.
-
-
Constructor Summary
Constructors Constructor Description WarURLConnection(java.net.URL url, java.util.jar.Manifest mf)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRequestProperty(java.lang.String key, java.lang.String value)
void
connect()
boolean
equals(java.lang.Object obj)
boolean
getAllowUserInteraction()
int
getConnectTimeout()
java.lang.Object
getContent()
java.lang.Object
getContent(java.lang.Class[] classes)
java.lang.String
getContentEncoding()
int
getContentLength()
java.lang.String
getContentType()
long
getDate()
boolean
getDefaultUseCaches()
boolean
getDoInput()
boolean
getDoOutput()
long
getExpiration()
java.lang.String
getHeaderField(int n)
java.lang.String
getHeaderField(java.lang.String name)
long
getHeaderFieldDate(java.lang.String name, long defaultVal)
int
getHeaderFieldInt(java.lang.String name, int defaultVal)
java.lang.String
getHeaderFieldKey(int n)
java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getHeaderFields()
long
getIfModifiedSince()
java.io.InputStream
getInputStream()
long
getLastModified()
java.io.OutputStream
getOutputStream()
java.security.Permission
getPermission()
int
getReadTimeout()
java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getRequestProperties()
java.lang.String
getRequestProperty(java.lang.String key)
java.net.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(java.lang.String key, java.lang.String value)
void
setUseCaches(boolean usecaches)
static java.io.InputStream
substitueManifest(java.util.jar.Manifest newmanifest, java.io.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
getContentLengthLong, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getFileNameMap, getHeaderFieldLong, guessContentTypeFromName, guessContentTypeFromStream, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setFileNameMap, toString
-
-
-
-
Constructor Detail
-
WarURLConnection
public WarURLConnection(java.net.URL url, java.util.jar.Manifest mf) throws java.io.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:
java.io.IOException
- if an I/O error occurs.
-
-
Method Detail
-
substitueManifest
public static java.io.InputStream substitueManifest(java.util.jar.Manifest newmanifest, java.io.InputStream rawIn) throws java.io.IOException
Use PipedOuputStream and PipedInputStream to do the transformation without making a new temporary file ust to replace the manifest.- Parameters:
newmanifest
- The new manifestrawIn
- The file input stream or equivalent. not the jar input stream.- Returns:
- InputStream of the replaced manifest file
- Throws:
java.io.IOException
- if an I/O error occurs.
-
connect
public void connect() throws java.io.IOException
- Specified by:
connect
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Overrides:
getInputStream
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
addRequestProperty
public void addRequestProperty(java.lang.String key, java.lang.String value)
- Overrides:
addRequestProperty
in classjava.net.URLConnection
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getAllowUserInteraction
public boolean getAllowUserInteraction()
- Overrides:
getAllowUserInteraction
in classjava.net.URLConnection
-
getConnectTimeout
public int getConnectTimeout()
- Overrides:
getConnectTimeout
in classjava.net.URLConnection
-
getContent
public java.lang.Object getContent() throws java.io.IOException
- Overrides:
getContent
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
getContent
public java.lang.Object getContent(java.lang.Class[] classes) throws java.io.IOException
- Overrides:
getContent
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
getContentEncoding
public java.lang.String getContentEncoding()
- Overrides:
getContentEncoding
in classjava.net.URLConnection
-
getContentLength
public int getContentLength()
- Overrides:
getContentLength
in classjava.net.URLConnection
-
getContentType
public java.lang.String getContentType()
- Overrides:
getContentType
in classjava.net.URLConnection
-
getDate
public long getDate()
- Overrides:
getDate
in classjava.net.URLConnection
-
getDefaultUseCaches
public boolean getDefaultUseCaches()
- Overrides:
getDefaultUseCaches
in classjava.net.URLConnection
-
getDoInput
public boolean getDoInput()
- Overrides:
getDoInput
in classjava.net.URLConnection
-
getDoOutput
public boolean getDoOutput()
- Overrides:
getDoOutput
in classjava.net.URLConnection
-
getExpiration
public long getExpiration()
- Overrides:
getExpiration
in classjava.net.URLConnection
-
getHeaderField
public java.lang.String getHeaderField(int n)
- Overrides:
getHeaderField
in classjava.net.URLConnection
-
getHeaderField
public java.lang.String getHeaderField(java.lang.String name)
- Overrides:
getHeaderField
in classjava.net.URLConnection
-
getHeaderFieldDate
public long getHeaderFieldDate(java.lang.String name, long defaultVal)
- Overrides:
getHeaderFieldDate
in classjava.net.URLConnection
-
getHeaderFieldInt
public int getHeaderFieldInt(java.lang.String name, int defaultVal)
- Overrides:
getHeaderFieldInt
in classjava.net.URLConnection
-
getHeaderFieldKey
public java.lang.String getHeaderFieldKey(int n)
- Overrides:
getHeaderFieldKey
in classjava.net.URLConnection
-
getHeaderFields
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaderFields()
- Overrides:
getHeaderFields
in classjava.net.URLConnection
-
getIfModifiedSince
public long getIfModifiedSince()
- Overrides:
getIfModifiedSince
in classjava.net.URLConnection
-
getLastModified
public long getLastModified()
- Overrides:
getLastModified
in classjava.net.URLConnection
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
- Overrides:
getOutputStream
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
getPermission
public java.security.Permission getPermission() throws java.io.IOException
- Overrides:
getPermission
in classjava.net.URLConnection
- Throws:
java.io.IOException
-
getReadTimeout
public int getReadTimeout()
- Overrides:
getReadTimeout
in classjava.net.URLConnection
-
getRequestProperties
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestProperties()
- Overrides:
getRequestProperties
in classjava.net.URLConnection
-
getRequestProperty
public java.lang.String getRequestProperty(java.lang.String key)
- Overrides:
getRequestProperty
in classjava.net.URLConnection
-
getURL
public java.net.URL getURL()
- Overrides:
getURL
in classjava.net.URLConnection
-
getUseCaches
public boolean getUseCaches()
- Overrides:
getUseCaches
in classjava.net.URLConnection
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean allowuserinteraction)
- Overrides:
setAllowUserInteraction
in classjava.net.URLConnection
-
setConnectTimeout
public void setConnectTimeout(int timeout)
- Overrides:
setConnectTimeout
in classjava.net.URLConnection
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean defaultusecaches)
- Overrides:
setDefaultUseCaches
in classjava.net.URLConnection
-
setDoInput
public void setDoInput(boolean doinput)
- Overrides:
setDoInput
in classjava.net.URLConnection
-
setDoOutput
public void setDoOutput(boolean dooutput)
- Overrides:
setDoOutput
in classjava.net.URLConnection
-
setIfModifiedSince
public void setIfModifiedSince(long ifmodifiedsince)
- Overrides:
setIfModifiedSince
in classjava.net.URLConnection
-
setReadTimeout
public void setReadTimeout(int timeout)
- Overrides:
setReadTimeout
in classjava.net.URLConnection
-
setRequestProperty
public void setRequestProperty(java.lang.String key, java.lang.String value)
- Overrides:
setRequestProperty
in classjava.net.URLConnection
-
setUseCaches
public void setUseCaches(boolean usecaches)
- Overrides:
setUseCaches
in classjava.net.URLConnection
-
-