Class WarURLConnection
java.lang.Object
java.net.URLConnection
org.eclipse.jetty.osgi.boot.warurl.internal.WarURLConnection
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequestProperty(String key, String value) voidconnect()booleanbooleanintgetContent(Class[] classes) intlonggetDate()booleanbooleanbooleanlonggetHeaderField(int n) getHeaderField(String name) longgetHeaderFieldDate(String name, long defaultVal) intgetHeaderFieldInt(String name, int defaultVal) getHeaderFieldKey(int n) longlongintgetRequestProperty(String key) getURL()booleanvoidsetAllowUserInteraction(boolean allowuserinteraction) voidsetConnectTimeout(int timeout) voidsetDefaultUseCaches(boolean defaultusecaches) voidsetDoInput(boolean doinput) voidsetDoOutput(boolean dooutput) voidsetIfModifiedSince(long ifmodifiedsince) voidsetReadTimeout(int timeout) voidsetRequestProperty(String key, String value) voidsetUseCaches(boolean usecaches) static InputStreamsubstitueManifest(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
getContentLengthLong, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getFileNameMap, getHeaderFieldLong, guessContentTypeFromName, guessContentTypeFromStream, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setFileNameMap, toString
-
Constructor Details
-
WarURLConnection
- 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- if an I/O error occurs.
-
-
Method Details
-
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 manifestrawIn- The file input stream or equivalent. not the jar input stream.- Returns:
- InputStream of the replaced manifest file
- Throws:
IOException- if an I/O error occurs.
-
connect
- Specified by:
connectin classURLConnection- Throws:
IOException
-
getInputStream
- Overrides:
getInputStreamin classURLConnection- Throws:
IOException
-
addRequestProperty
- Overrides:
addRequestPropertyin classURLConnection
-
equals
-
getAllowUserInteraction
public boolean getAllowUserInteraction()- Overrides:
getAllowUserInteractionin classURLConnection
-
getConnectTimeout
public int getConnectTimeout()- Overrides:
getConnectTimeoutin classURLConnection
-
getContent
- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getContent
- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getContentEncoding
- Overrides:
getContentEncodingin classURLConnection
-
getContentLength
public int getContentLength()- Overrides:
getContentLengthin classURLConnection
-
getContentType
- Overrides:
getContentTypein classURLConnection
-
getDate
public long getDate()- Overrides:
getDatein classURLConnection
-
getDefaultUseCaches
public boolean getDefaultUseCaches()- Overrides:
getDefaultUseCachesin classURLConnection
-
getDoInput
public boolean getDoInput()- Overrides:
getDoInputin classURLConnection
-
getDoOutput
public boolean getDoOutput()- Overrides:
getDoOutputin classURLConnection
-
getExpiration
public long getExpiration()- Overrides:
getExpirationin classURLConnection
-
getHeaderField
- Overrides:
getHeaderFieldin classURLConnection
-
getHeaderField
- Overrides:
getHeaderFieldin classURLConnection
-
getHeaderFieldDate
- Overrides:
getHeaderFieldDatein classURLConnection
-
getHeaderFieldInt
- Overrides:
getHeaderFieldIntin classURLConnection
-
getHeaderFieldKey
- Overrides:
getHeaderFieldKeyin classURLConnection
-
getHeaderFields
- Overrides:
getHeaderFieldsin classURLConnection
-
getIfModifiedSince
public long getIfModifiedSince()- Overrides:
getIfModifiedSincein classURLConnection
-
getLastModified
public long getLastModified()- Overrides:
getLastModifiedin classURLConnection
-
getOutputStream
- Overrides:
getOutputStreamin classURLConnection- Throws:
IOException
-
getPermission
- Overrides:
getPermissionin classURLConnection- Throws:
IOException
-
getReadTimeout
public int getReadTimeout()- Overrides:
getReadTimeoutin classURLConnection
-
getRequestProperties
- Overrides:
getRequestPropertiesin classURLConnection
-
getRequestProperty
- Overrides:
getRequestPropertyin classURLConnection
-
getURL
- Overrides:
getURLin classURLConnection
-
getUseCaches
public boolean getUseCaches()- Overrides:
getUseCachesin classURLConnection
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean allowuserinteraction) - Overrides:
setAllowUserInteractionin classURLConnection
-
setConnectTimeout
public void setConnectTimeout(int timeout) - Overrides:
setConnectTimeoutin classURLConnection
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean defaultusecaches) - Overrides:
setDefaultUseCachesin classURLConnection
-
setDoInput
public void setDoInput(boolean doinput) - Overrides:
setDoInputin classURLConnection
-
setDoOutput
public void setDoOutput(boolean dooutput) - Overrides:
setDoOutputin classURLConnection
-
setIfModifiedSince
public void setIfModifiedSince(long ifmodifiedsince) - Overrides:
setIfModifiedSincein classURLConnection
-
setReadTimeout
public void setReadTimeout(int timeout) - Overrides:
setReadTimeoutin classURLConnection
-
setRequestProperty
- Overrides:
setRequestPropertyin classURLConnection
-
setUseCaches
public void setUseCaches(boolean usecaches) - Overrides:
setUseCachesin classURLConnection
-