Top Fields Constructors Methods
org.apache.catalina.webresources.war

public Class WarURLConnection

extends URLConnection
Class Inheritance
Imports
java.io.IOException, .InputStream, java.net.URL, .URLConnection, java.security.Permission, org.apache.tomcat.util.buf.UriUtil

Field Summary

Modifier and TypeField and Description
private boolean
private final URLConnection
Inherited from java.net.URLConnection:
allowUserInteractiondoInputdoOutputifModifiedSinceurluseCaches

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
connect()

Implements abstract java.net.URLConnection.connect.

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

public int
getContentLength()

Overrides java.net.URLConnection.getContentLength.

Returns the value of the content-length header field.

public long
getContentLengthLong()

Overrides java.net.URLConnection.getContentLengthLong.

Returns the value of the content-length header field as a long.

public InputStream
getInputStream()

Overrides java.net.URLConnection.getInputStream.

Returns an input stream that reads from this open connection.

public long
getLastModified()

Overrides java.net.URLConnection.getLastModified.

Returns the value of the last-modified header field.

public Permission
getPermission()

Overrides java.net.URLConnection.getPermission.

Returns a permission object representing the permission necessary to make the connection represented by this object.

Inherited from java.net.URLConnection:
addRequestPropertygetAllowUserInteractiongetConnectTimeoutgetContentgetContentgetContentEncodinggetContentTypegetDategetDefaultAllowUserInteractiongetDefaultRequestPropertygetDefaultUseCachesgetDefaultUseCachesgetDoInputgetDoOutputgetExpirationgetFileNameMapgetHeaderFieldgetHeaderFieldgetHeaderFieldDategetHeaderFieldIntgetHeaderFieldKeygetHeaderFieldLonggetHeaderFieldsgetIfModifiedSincegetOutputStreamgetReadTimeoutgetRequestPropertiesgetRequestPropertygetURLgetUseCachesguessContentTypeFromNameguessContentTypeFromStreamsetAllowUserInteractionsetConnectTimeoutsetContentHandlerFactorysetDefaultAllowUserInteractionsetDefaultRequestPropertysetDefaultUseCachessetDefaultUseCachessetDoInputsetDoOutputsetFileNameMapsetIfModifiedSincesetReadTimeoutsetRequestPropertysetUseCachestoString

Field Detail

connectedback to summary
private boolean connected

Hides java.net.URLConnection.connected.

wrappedJarUrlConnectionback to summary
private final URLConnection wrappedJarUrlConnection

Constructor Detail

WarURLConnectionback to summary
protected WarURLConnection(URL url) throws IOException

Method Detail

connectback to summary
public void connect() throws IOException

Implements abstract java.net.URLConnection.connect.

Doc from java.net.URLConnection.connect.

Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.

If the connect method is called when the connection has already been opened (indicated by the connected field having the value true), the call is ignored.

URLConnection objects go through two phases: first they are created, then they are connected. After being created, and before being connected, various options can be specified (e.g., doInput and UseCaches). After connecting, it is an error to try to set them. Operations that depend on being connected, like getContentLength, will implicitly perform the connection, if necessary.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while opening the connection.
getContentLengthback to summary
public int getContentLength()

Overrides java.net.URLConnection.getContentLength.

Doc from java.net.URLConnection.getContentLength.

Returns the value of the content-length header field.

Note

getContentLengthLong() should be preferred over this method, since it returns a long instead and is therefore more portable.

Returns:int

the content length of the resource that this connection's URL references, -1 if the content length is not known, or if the content length is greater than Integer.MAX_VALUE.

Annotations
@Override
getContentLengthLongback to summary
public long getContentLengthLong()

Overrides java.net.URLConnection.getContentLengthLong.

Doc from java.net.URLConnection.getContentLengthLong.

Returns the value of the content-length header field as a long.

Returns:long

the content length of the resource that this connection's URL references, or -1 if the content length is not known.

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Overrides java.net.URLConnection.getInputStream.

Doc from java.net.URLConnection.getInputStream.

Returns an input stream that reads from this open connection. A SocketTimeoutException can be thrown when reading from the returned input stream if the read timeout expires before data is available for read.

Returns:InputStream

an input stream that reads from this open connection.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while creating the input stream.
getLastModifiedback to summary
public long getLastModified()

Overrides java.net.URLConnection.getLastModified.

Doc from java.net.URLConnection.getLastModified.

Returns the value of the last-modified header field. The result is the number of milliseconds since January 1, 1970 GMT.

Returns:long

the date the resource referenced by this URLConnection was last modified, or 0 if not known.

Annotations
@Override
getPermissionback to summary
public Permission getPermission() throws IOException

Overrides java.net.URLConnection.getPermission.

Doc from java.net.URLConnection.getPermission.

Returns a permission object representing the permission necessary to make the connection represented by this object. This method returns null if no permission is required to make the connection. By default, this method returns java.security.AllPermission. Subclasses should override this method and return the permission that best represents the permission required to make a connection to the URL. For example, a URLConnection representing a file: URL would return a java.io.FilePermission object.

The permission returned may dependent upon the state of the connection. For example, the permission before connecting may be different from that after connecting. For example, an HTTP sever, say foo.com, may redirect the connection to a different host, say bar.com. Before connecting the permission returned by the connection will represent the permission needed to connect to foo.com, while the permission returned after connecting will be to bar.com.

Permissions are generally used for two purposes: to protect caches of objects obtained through URLConnections, and to check the right of a recipient to learn about a particular URL. In the first case, the permission should be obtained after the object has been obtained. For example, in an HTTP connection, this will represent the permission to connect to the host from which the data was ultimately fetched. In the second case, the permission should be obtained and tested before connecting.

Returns:Permission

the permission object representing the permission necessary to make the connection represented by this URLConnection.

Annotations
@Override
Exceptions
IOException:
if the computation of the permission requires network or file I/O and an exception occurs while computing it.