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

Variable Index

 o ATTR_FILENAME
Attributes index - The filename attribute.
 o ATTR_FILESTAMP
Attribute index - The date at which we last checked the file content.
 o ATTR_PUTABLE
Attribute index - Do we allow PUT method on this file.
 o file
The file we refer to.

Constructor Index

 o FileResource()

Method Index

 o get(Request)
The GET method on files.
 o getBackupFile()
Get the name of the backup file for this resource.
 o getFile()
Get this file resource file name.
 o getFilename()
Get this resource filename attribute.
 o getFileStamp()
Get the date at which we last examined the file.
 o getPutableFlag()
Get the PUT'able flag (are we allow to PUT to the resource ?)
 o newContent(InputStream)
Save the given stream as the underlying file content.
 o put(Request)
Put a new entity in this resource.
 o setValue(int, Object)
Set some of this resource attribute.
 o updateAttributes()
Update our computed attributes.
 o updateFileAttributes()
Update the file related attributes.

Variables

 o ATTR_FILENAME
  protected static int ATTR_FILENAME
Attributes index - The filename attribute.
 o ATTR_PUTABLE
  protected static int ATTR_PUTABLE
Attribute index - Do we allow PUT method on this file.
 o ATTR_FILESTAMP
  protected static int ATTR_FILESTAMP
Attribute index - The date at which we last checked the file content.
 o 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.

Constructors

 o FileResource
  public FileResource()

Methods

 o getFilename
  public String getFilename()
Get this resource filename attribute.
 o getPutableFlag
  public boolean getPutableFlag()
Get the PUT'able flag (are we allow to PUT to the resource ?)
 o getFileStamp
  public long getFileStamp()
Get the date at which we last examined the file.
 o 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.
 o 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.
 o 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
 o getFile
  public synchronized File getFile()
Get this file resource file name.
 o 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
 o 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
 o 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.
 o updateAttributes
  public void updateAttributes()
Update our computed attributes.
Overrides:
updateAttributes in class Resource

All Packages  Class Hierarchy  This Package  Previous  Next  Index