public class CachedResource extends Object implements WebResource
| Constructor and Description |
|---|
CachedResource(Cache cache,
StandardRoot root,
String path,
long ttl,
int objectMaxSizeBytes,
boolean usesClassLoaderResources) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead() |
boolean |
delete() |
boolean |
exists() |
String |
getCanonicalPath() |
Certificate[] |
getCertificates() |
URL |
getCodeBase() |
byte[] |
getContent() |
long |
getContentLength() |
long |
getCreation() |
String |
getETag()
Return the strong ETag if available (currently not supported) else return
the weak ETag calculated from the content length and last modified.
|
InputStream |
getInputStream()
Obtain an InputStream based on the contents of this resource.
|
long |
getLastModified() |
String |
getLastModifiedHttp() |
Manifest |
getManifest() |
String |
getMimeType() |
String |
getName() |
protected long |
getNextCheck() |
URL |
getURL() |
String |
getWebappPath() |
WebResourceRoot |
getWebResourceRoot() |
boolean |
isDirectory() |
boolean |
isFile() |
boolean |
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. |
void |
setMimeType(String mimeType)
Set the MIME type for this Resource.
|
protected boolean |
validateResource(boolean useClassLoaderResources) |
protected boolean |
validateResources(boolean useClassLoaderResources) |
public CachedResource(Cache cache, StandardRoot root, String path, long ttl, int objectMaxSizeBytes, boolean usesClassLoaderResources)
protected boolean validateResource(boolean useClassLoaderResources)
protected boolean validateResources(boolean useClassLoaderResources)
protected long getNextCheck()
public long getLastModified()
getLastModified in interface WebResourceFile.lastModified().public String getLastModifiedHttp()
getLastModifiedHttp in interface WebResourcepublic boolean exists()
exists in interface WebResourceFile.exists().public boolean isVirtual()
WebResourceWebResourceSet. 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.isVirtual in interface WebResourcetrue for a virtual resourcepublic boolean isDirectory()
isDirectory in interface WebResourceFile.isDirectory().public boolean isFile()
isFile in interface WebResourceFile.isFile().public boolean delete()
delete in interface WebResourceFile.delete().public String getName()
getName in interface WebResourceFile.getName().public long getContentLength()
getContentLength in interface WebResourceFile.length().public String getCanonicalPath()
getCanonicalPath in interface WebResourceFile.getCanonicalPath().public boolean canRead()
canRead in interface WebResourceFile.canRead().public String getWebappPath()
getWebappPath in interface WebResourcepublic String getETag()
WebResourcegetETag in interface WebResourcepublic void setMimeType(String mimeType)
WebResourcesetMimeType in interface WebResourcemimeType - The mime type that will be associated with the resourcepublic String getMimeType()
getMimeType in interface WebResourcepublic InputStream getInputStream()
WebResourcegetInputStream in interface WebResourcenull if the resource does not exist or does not
represent a filepublic byte[] getContent()
getContent in interface WebResourcenull if it is not
available in a byte[] because, for example, it is too big.public long getCreation()
getCreation in interface WebResourceWebResource.getLastModified() will be returned.public URL getURL()
getURL in interface WebResourcenull if no such URL
is available or if the resource does not exist.public URL getCodeBase()
getCodeBase in interface WebResourcepublic Certificate[] getCertificates()
getCertificates in interface WebResourceJarEntry.getCertificates()public Manifest getManifest()
getManifest in interface WebResourceJarFile.getManifest()public WebResourceRoot getWebResourceRoot()
getWebResourceRoot in interface WebResourceCopyright © 2000-2022 Apache Software Foundation. All Rights Reserved.