public class FileResource extends AbstractResource
sm
Constructor and Description |
---|
FileResource(WebResourceRoot root,
String webAppPath,
File resource) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
See
File.canRead() . |
boolean |
delete()
See
File.delete() . |
boolean |
exists()
See
File.exists() . |
String |
getCanonicalPath()
|
long |
getContentLength()
See
File.length() . |
long |
getCreation()
The time the file was created.
|
InputStream |
getInputStream()
Obtain an InputStream based on the contents of this resource.
|
long |
getLastModified()
See
File.lastModified() . |
protected Log |
getLog() |
String |
getName()
See
File.getName() . |
protected File |
getResourceInternal() |
URL |
getURL()
Obtain a URL to access the resource or
null if no such URL
is available or if the resource does not exist. |
boolean |
isDirectory()
See
File.isDirectory() . |
boolean |
isFile()
See
File.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 . |
getContent, getETag, getLastModifiedHttp, getMimeType, getWebappPath, getWebResourceRoot, setMimeType
public FileResource(WebResourceRoot root, String webAppPath, File resource)
public long getLastModified()
WebResource
File.lastModified()
.public boolean exists()
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.public boolean isDirectory()
WebResource
File.isDirectory()
.public boolean isFile()
WebResource
File.isFile()
.public boolean delete()
WebResource
File.delete()
.public String getName()
WebResource
File.getName()
.public long getContentLength()
WebResource
File.length()
.public String getCanonicalPath()
WebResource
public boolean canRead()
WebResource
File.canRead()
.public InputStream getInputStream()
WebResource
null
if the resource does not exist or does not
represent a filepublic long getCreation()
WebResource
WebResource.getLastModified()
will be returned.public URL getURL()
WebResource
null
if no such URL
is available or if the resource does not exist.protected File getResourceInternal()
protected Log getLog()
getLog
in class AbstractResource
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.