Class WarURLConnection
- java.lang.Object
-
- java.net.URLConnection
-
- org.eclipse.jetty.osgi.boot.warurl.internal.WarURLConnection
-
public class WarURLConnection extends java.net.URLConnectionFacade 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 voidaddRequestProperty(java.lang.String key, java.lang.String value)voidconnect()booleanequals(java.lang.Object obj)booleangetAllowUserInteraction()intgetConnectTimeout()java.lang.ObjectgetContent()java.lang.ObjectgetContent(java.lang.Class[] classes)java.lang.StringgetContentEncoding()intgetContentLength()java.lang.StringgetContentType()longgetDate()booleangetDefaultUseCaches()booleangetDoInput()booleangetDoOutput()longgetExpiration()java.lang.StringgetHeaderField(int n)java.lang.StringgetHeaderField(java.lang.String name)longgetHeaderFieldDate(java.lang.String name, long defaultVal)intgetHeaderFieldInt(java.lang.String name, int defaultVal)java.lang.StringgetHeaderFieldKey(int n)java.util.Map<java.lang.String,java.util.List<java.lang.String>>getHeaderFields()longgetIfModifiedSince()java.io.InputStreamgetInputStream()longgetLastModified()java.io.OutputStreamgetOutputStream()java.security.PermissiongetPermission()intgetReadTimeout()java.util.Map<java.lang.String,java.util.List<java.lang.String>>getRequestProperties()java.lang.StringgetRequestProperty(java.lang.String key)java.net.URLgetURL()booleangetUseCaches()voidsetAllowUserInteraction(boolean allowuserinteraction)voidsetConnectTimeout(int timeout)voidsetDefaultUseCaches(boolean defaultusecaches)voidsetDoInput(boolean doinput)voidsetDoOutput(boolean dooutput)voidsetIfModifiedSince(long ifmodifiedsince)voidsetReadTimeout(int timeout)voidsetRequestProperty(java.lang.String key, java.lang.String value)voidsetUseCaches(boolean usecaches)static java.io.InputStreamsubstitueManifest(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.IOExceptionUse 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:
connectin classjava.net.URLConnection- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Overrides:
getInputStreamin classjava.net.URLConnection- Throws:
java.io.IOException
-
addRequestProperty
public void addRequestProperty(java.lang.String key, java.lang.String value)- Overrides:
addRequestPropertyin classjava.net.URLConnection
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getAllowUserInteraction
public boolean getAllowUserInteraction()
- Overrides:
getAllowUserInteractionin classjava.net.URLConnection
-
getConnectTimeout
public int getConnectTimeout()
- Overrides:
getConnectTimeoutin classjava.net.URLConnection
-
getContent
public java.lang.Object getContent() throws java.io.IOException- Overrides:
getContentin classjava.net.URLConnection- Throws:
java.io.IOException
-
getContent
public java.lang.Object getContent(java.lang.Class[] classes) throws java.io.IOException- Overrides:
getContentin classjava.net.URLConnection- Throws:
java.io.IOException
-
getContentEncoding
public java.lang.String getContentEncoding()
- Overrides:
getContentEncodingin classjava.net.URLConnection
-
getContentLength
public int getContentLength()
- Overrides:
getContentLengthin classjava.net.URLConnection
-
getContentType
public java.lang.String getContentType()
- Overrides:
getContentTypein classjava.net.URLConnection
-
getDate
public long getDate()
- Overrides:
getDatein classjava.net.URLConnection
-
getDefaultUseCaches
public boolean getDefaultUseCaches()
- Overrides:
getDefaultUseCachesin classjava.net.URLConnection
-
getDoInput
public boolean getDoInput()
- Overrides:
getDoInputin classjava.net.URLConnection
-
getDoOutput
public boolean getDoOutput()
- Overrides:
getDoOutputin classjava.net.URLConnection
-
getExpiration
public long getExpiration()
- Overrides:
getExpirationin classjava.net.URLConnection
-
getHeaderField
public java.lang.String getHeaderField(int n)
- Overrides:
getHeaderFieldin classjava.net.URLConnection
-
getHeaderField
public java.lang.String getHeaderField(java.lang.String name)
- Overrides:
getHeaderFieldin classjava.net.URLConnection
-
getHeaderFieldDate
public long getHeaderFieldDate(java.lang.String name, long defaultVal)- Overrides:
getHeaderFieldDatein classjava.net.URLConnection
-
getHeaderFieldInt
public int getHeaderFieldInt(java.lang.String name, int defaultVal)- Overrides:
getHeaderFieldIntin classjava.net.URLConnection
-
getHeaderFieldKey
public java.lang.String getHeaderFieldKey(int n)
- Overrides:
getHeaderFieldKeyin classjava.net.URLConnection
-
getHeaderFields
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaderFields()
- Overrides:
getHeaderFieldsin classjava.net.URLConnection
-
getIfModifiedSince
public long getIfModifiedSince()
- Overrides:
getIfModifiedSincein classjava.net.URLConnection
-
getLastModified
public long getLastModified()
- Overrides:
getLastModifiedin classjava.net.URLConnection
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException- Overrides:
getOutputStreamin classjava.net.URLConnection- Throws:
java.io.IOException
-
getPermission
public java.security.Permission getPermission() throws java.io.IOException- Overrides:
getPermissionin classjava.net.URLConnection- Throws:
java.io.IOException
-
getReadTimeout
public int getReadTimeout()
- Overrides:
getReadTimeoutin classjava.net.URLConnection
-
getRequestProperties
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getRequestProperties()
- Overrides:
getRequestPropertiesin classjava.net.URLConnection
-
getRequestProperty
public java.lang.String getRequestProperty(java.lang.String key)
- Overrides:
getRequestPropertyin classjava.net.URLConnection
-
getURL
public java.net.URL getURL()
- Overrides:
getURLin classjava.net.URLConnection
-
getUseCaches
public boolean getUseCaches()
- Overrides:
getUseCachesin classjava.net.URLConnection
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean allowuserinteraction)
- Overrides:
setAllowUserInteractionin classjava.net.URLConnection
-
setConnectTimeout
public void setConnectTimeout(int timeout)
- Overrides:
setConnectTimeoutin classjava.net.URLConnection
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean defaultusecaches)
- Overrides:
setDefaultUseCachesin classjava.net.URLConnection
-
setDoInput
public void setDoInput(boolean doinput)
- Overrides:
setDoInputin classjava.net.URLConnection
-
setDoOutput
public void setDoOutput(boolean dooutput)
- Overrides:
setDoOutputin classjava.net.URLConnection
-
setIfModifiedSince
public void setIfModifiedSince(long ifmodifiedsince)
- Overrides:
setIfModifiedSincein classjava.net.URLConnection
-
setReadTimeout
public void setReadTimeout(int timeout)
- Overrides:
setReadTimeoutin classjava.net.URLConnection
-
setRequestProperty
public void setRequestProperty(java.lang.String key, java.lang.String value)- Overrides:
setRequestPropertyin classjava.net.URLConnection
-
setUseCaches
public void setUseCaches(boolean usecaches)
- Overrides:
setUseCachesin classjava.net.URLConnection
-
-