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

public Class FileResource

extends AbstractResource
Class Inheritance
Imports
java.io.ByteArrayInputStream, .File, .FileInputStream, .FileNotFoundException, .IOException, .InputStream, java.net.MalformedURLException, .URL, java.nio.charset.Charset, .StandardCharsets, java.nio.file.Files, java.nio.file.attribute.BasicFileAttributes, java.security.cert.Certificate, java.util.jar.Manifest, org.apache.catalina.WebResourceRoot, org.apache.juli.logging.Log, .LogFactory

Represents a single resource (file or directory) that is located on a file system.

Field Summary

Modifier and TypeField and Description
private static final Log
private final Manifest
private final String
private final boolean
private static final boolean
private final boolean
private final File
Inherited from org.apache.catalina.webresources.AbstractResource:
sm

Constructor Summary

AccessConstructor and Description
public
FileResource(WebResourceRoot root, String webAppPath, File resource, boolean readOnly, Manifest manifest)

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
protected InputStream
public boolean
public String
public Certificate[]
public URL
public final byte[]
public long
private long
getContentLengthInternal(boolean convert)

public long
public long
protected Log
public Manifest
public String
public URL
public boolean
public boolean
public boolean
isVirtual()

Implements org.apache.catalina.WebResource.isVirtual.

Indicates if this resource is required for applications to correctly scan the file structure but that does not exist in either the main or any additional WebResourceSet.

Inherited from org.apache.catalina.webresources.AbstractResource:
getETaggetInputStreamgetLastModifiedHttpgetMimeTypegetWebappPathgetWebResourceRootsetMimeType

Field Detail

logback to summary
private static final Log log
manifestback to summary
private final Manifest manifest
nameback to summary
private final String name
needConvertback to summary
private final boolean needConvert
PROPERTIES_NEED_CONVERTback to summary
private static final boolean PROPERTIES_NEED_CONVERT
readOnlyback to summary
private final boolean readOnly
resourceback to summary
private final File resource

Constructor Detail

FileResourceback to summary
public FileResource(WebResourceRoot root, String webAppPath, File resource, boolean readOnly, Manifest manifest)

Method Detail

canReadback to summary
public boolean canRead()

Implements org.apache.catalina.WebResource.canRead.

Returns:boolean

Doc from org.apache.catalina.WebResource.canRead.

java.io.File#canRead().

Annotations
@Override
deleteback to summary
public boolean delete()

Implements org.apache.catalina.WebResource.delete.

Returns:boolean

Doc from org.apache.catalina.WebResource.delete.

java.io.File#delete().

Annotations
@Override
doGetInputStreamback to summary
protected InputStream doGetInputStream()

Implements abstract org.apache.catalina.webresources.AbstractResource.doGetInputStream.

Annotations
@Override
existsback to summary
public boolean exists()

Implements org.apache.catalina.WebResource.exists.

Returns:boolean

Doc from org.apache.catalina.WebResource.exists.

java.io.File#exists().

Annotations
@Override
getCanonicalPathback to summary
public String getCanonicalPath()

Implements org.apache.catalina.WebResource.getCanonicalPath.

Returns:String

Doc from org.apache.catalina.WebResource.getCanonicalPath.

java.io.File#getCanonicalPath().

Annotations
@Override
getCertificatesback to summary
public Certificate[] getCertificates()

Implements org.apache.catalina.WebResource.getCertificates.

Returns:Certificate[]

Doc from org.apache.catalina.WebResource.getCertificates.

the certificates that were used to sign this resource to verify it or @null if none.

Annotations
@Override
getCodeBaseback to summary
public URL getCodeBase()

Implements org.apache.catalina.WebResource.getCodeBase.

Returns:URL

Doc from org.apache.catalina.WebResource.getCodeBase.

the code base for this resource that will be used when looking up the assigned permissions for the code base in the security policy file when running under a security manager.

Annotations
@Override
getContentback to summary
public final byte[] getContent()

Implements org.apache.catalina.WebResource.getContent.

Returns:byte[]

Doc from org.apache.catalina.WebResource.getContent.

the binary content of this resource or null if it is not available in a byte[] because, for example, it is too big.

Annotations
@Override
getContentLengthback to summary
public long getContentLength()

Implements org.apache.catalina.WebResource.getContentLength.

Returns:long

Doc from org.apache.catalina.WebResource.getContentLength.

java.io.File#length().

Annotations
@Override
getContentLengthInternalback to summary
private long getContentLengthInternal(boolean convert)
getCreationback to summary
public long getCreation()

Implements org.apache.catalina.WebResource.getCreation.

Returns:long

Doc from org.apache.catalina.WebResource.getCreation.

The time the file was created. If not available, the result of getLastModified() will be returned.

Annotations
@Override
getLastModifiedback to summary
public long getLastModified()

Implements org.apache.catalina.WebResource.getLastModified.

Returns:long

Doc from org.apache.catalina.WebResource.getLastModified.

java.io.File#lastModified().

Annotations
@Override
getLogback to summary
protected Log getLog()

Implements abstract org.apache.catalina.webresources.AbstractResource.getLog.

Annotations
@Override
getManifestback to summary
public Manifest getManifest()

Implements org.apache.catalina.WebResource.getManifest.

Returns:Manifest

Doc from org.apache.catalina.WebResource.getManifest.

the manifest associated with this resource or @null if none.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.apache.catalina.WebResource.getName.

Returns:String

Doc from org.apache.catalina.WebResource.getName.

java.io.File#getName().

Annotations
@Override
getURLback to summary
public URL getURL()

Implements org.apache.catalina.WebResource.getURL.

Returns:URL

Doc from org.apache.catalina.WebResource.getURL.

a URL to access the resource or null if no such URL is available or if the resource does not exist.

Annotations
@Override
isDirectoryback to summary
public boolean isDirectory()

Implements org.apache.catalina.WebResource.isDirectory.

Returns:boolean

Doc from org.apache.catalina.WebResource.isDirectory.

java.io.File#isDirectory().

Annotations
@Override
isFileback to summary
public boolean isFile()

Implements org.apache.catalina.WebResource.isFile.

Returns:boolean

Doc from org.apache.catalina.WebResource.isFile.

java.io.File#isFile().

Annotations
@Override
isVirtualback to summary
public boolean isVirtual()

Implements org.apache.catalina.WebResource.isVirtual.

Doc from org.apache.catalina.WebResource.isVirtual.

Indicates if this resource is required for applications to correctly scan the file structure but that does not exist in either the main or any additional WebResourceSet. For example, if an external directory is mapped to /WEB-INF/lib in an otherwise empty web application, /WEB-INF will be represented as a virtual resource.

Returns:boolean

true for a virtual resource

Annotations
@Override