public class CachedResource extends Object implements WebResource
Constructor and Description |
---|
CachedResource(Cache cache,
StandardRoot root,
String path,
long ttl,
int objectMaxSizeBytes) |
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)
protected boolean validateResource(boolean useClassLoaderResources)
protected boolean validateResources(boolean useClassLoaderResources)
protected long getNextCheck()
public long getLastModified()
getLastModified
in interface WebResource
File.lastModified()
.public String getLastModifiedHttp()
getLastModifiedHttp
in interface WebResource
public boolean exists()
exists
in interface WebResource
File.exists()
.public boolean isVirtual()
WebResource
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.isVirtual
in interface WebResource
true
for a virtual resourcepublic boolean isDirectory()
isDirectory
in interface WebResource
File.isDirectory()
.public boolean isFile()
isFile
in interface WebResource
File.isFile()
.public boolean delete()
delete
in interface WebResource
File.delete()
.public String getName()
getName
in interface WebResource
File.getName()
.public long getContentLength()
getContentLength
in interface WebResource
File.length()
.public String getCanonicalPath()
getCanonicalPath
in interface WebResource
File.getCanonicalPath()
.public boolean canRead()
canRead
in interface WebResource
File.canRead()
.public String getWebappPath()
getWebappPath
in interface WebResource
public String getETag()
WebResource
getETag
in interface WebResource
public void setMimeType(String mimeType)
WebResource
setMimeType
in interface WebResource
mimeType
- The mime type that will be associated with the resourcepublic String getMimeType()
getMimeType
in interface WebResource
public InputStream getInputStream()
WebResource
getInputStream
in interface WebResource
null
if the resource does not exist or does not
represent a filepublic byte[] getContent()
getContent
in interface WebResource
public long getCreation()
getCreation
in interface WebResource
WebResource.getLastModified()
will be returned.public URL getURL()
getURL
in interface WebResource
null
if no such URL
is available or if the resource does not exist.public URL getCodeBase()
getCodeBase
in interface WebResource
public Certificate[] getCertificates()
getCertificates
in interface WebResource
JarEntry.getCertificates()
public Manifest getManifest()
getManifest
in interface WebResource
JarFile.getManifest()
public WebResourceRoot getWebResourceRoot()
getWebResourceRoot
in interface WebResource
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.