Class w3c.jigsaw.resources.FileResource
All Packages Class Hierarchy This Package Previous Next Index
Class w3c.jigsaw.resources.FileResource
java.lang.Object
|
+----w3c.jigsaw.resources.AttributeHolder
|
+----w3c.jigsaw.resources.Resource
|
+----w3c.jigsaw.resources.HTTPResource
|
+----w3c.jigsaw.resources.ContainerResource
|
+----w3c.jigsaw.resources.FilteredResource
|
+----w3c.jigsaw.resources.FileResource
- public class FileResource
- extends FilteredResource
-
ATTR_FILENAME
- Attributes index - The filename attribute.
-
ATTR_FILESTAMP
- Attribute index - The date at which we last checked the file content.
-
ATTR_PUTABLE
- Attribute index - Do we allow PUT method on this file.
-
file
- The file we refer to.
-
FileResource()
-
-
get(Request)
- The GET method on files.
-
getBackupFile()
- Get the name of the backup file for this resource.
-
getFile()
- Get this file resource file name.
-
getFilename()
- Get this resource filename attribute.
-
getFileStamp()
- Get the date at which we last examined the file.
-
getPutableFlag()
- Get the PUT'able flag (are we allow to PUT to the resource ?)
-
newContent(InputStream)
- Save the given stream as the underlying file content.
-
put(Request)
- Put a new entity in this resource.
-
setValue(int, Object)
- Set some of this resource attribute.
-
updateAttributes()
- Update our computed attributes.
-
updateFileAttributes()
- Update the file related attributes.
ATTR_FILENAME
protected static int ATTR_FILENAME
- Attributes index - The filename attribute.
ATTR_PUTABLE
protected static int ATTR_PUTABLE
- Attribute index - Do we allow PUT method on this file.
ATTR_FILESTAMP
protected static int ATTR_FILESTAMP
- Attribute index - The date at which we last checked the file content.
file
protected File file
- The file we refer to.
This is a cached version of some attributes, so we need to override
the setValue method in order to be able to catch any changes to it.
FileResource
public FileResource()
getFilename
public String getFilename()
- Get this resource filename attribute.
getPutableFlag
public boolean getPutableFlag()
- Get the PUT'able flag (are we allow to PUT to the resource ?)
getFileStamp
public long getFileStamp()
- Get the date at which we last examined the file.
getBackupFile
public File getBackupFile()
- Get the name of the backup file for this resource.
- Returns:
- A File object suitable to receive the backup version of this
file.
newContent
protected synchronized void newContent(InputStream in) throws IOException
- Save the given stream as the underlying file content.
This method preserve the old file version in a
~
file.
- Parameters:
- in - The input stream to use as the resource entity.
- Throws: IOException
- If dumping the content failed.
setValue
public synchronized void setValue(int idx,
Object value)
- Set some of this resource attribute.
We just catch here any write access to the filename's, to update
our cache file object.
- Overrides:
- setValue in class Resource
getFile
public synchronized File getFile()
- Get this file resource file name.
get
public Reply get(Request request) throws HTTPException
- The GET method on files.
Check for the last modified time against the IMS if any. If OK, emit
a not modified reply, otherwise, emit the whole file.
- Parameters:
- request - The request to handle.
- Throws: HTTPException
- If some error occured.
- Overrides:
- get in class HTTPResource
put
public synchronized Reply put(Request request) throws HTTPException
- Put a new entity in this resource.
- Parameters:
- request - The request to handle.
- Overrides:
- put in class HTTPResource
updateFileAttributes
public void updateFileAttributes()
- Update the file related attributes.
The file we serve has changed since the last time we checked it, if
any of the attribute values depend on the file content, this is the
appropriate place to recompute them.
updateAttributes
public void updateAttributes()
- Update our computed attributes.
- Overrides:
- updateAttributes in class Resource
All Packages Class Hierarchy This Package Previous Next Index