com.caucho.servlets.webdav
Class ApplicationPath

java.lang.Object
  extended by com.caucho.servlets.webdav.AbstractPath
      extended by com.caucho.servlets.webdav.ApplicationPath
Direct Known Subclasses:
FilePath, XmlApplicationPath

public class ApplicationPath
extends AbstractPath

Represents a virtual filesystem.


Field Summary
 
Fields inherited from class com.caucho.servlets.webdav.AbstractPath
log
 
Constructor Summary
ApplicationPath()
           
 
Method Summary
 boolean canRead(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the file can be read.
 boolean exists(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the file exists.
 java.lang.String getAttribute(AttributeName name, java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns an attribute value.
 java.util.Iterator getAttributeNames(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns an iterator over the attribute names.
 long getLastModified(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns the last modified time of the named file.
 long getLength(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns the length of the named file.
protected  Path getPath(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns the underlying path.
 boolean isDirectory(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the named file is a directory.
 boolean isFile(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns true if the named file is a file.
 java.lang.String[] list(java.lang.String path, HttpServletRequest request, ServletContext app)
          Returns a list of the files in the directory.
 boolean mkdir(java.lang.String path, HttpServletRequest request, ServletContext app)
          Creates the named directory.
 java.io.InputStream openRead(java.lang.String path, HttpServletRequest request, ServletContext app)
          Opens an InputStream for reading
 java.io.OutputStream openWrite(java.lang.String path, HttpServletRequest request, ServletContext app)
          Opens an OutputStream for writing.
 boolean remove(java.lang.String path, HttpServletRequest request, ServletContext app)
          Deletes the file
 void removeAttribute(java.lang.String name, java.lang.String path, HttpServletRequest request, ServletContext app)
          Removes an attribute value.
 boolean rmdir(java.lang.String path, HttpServletRequest request, ServletContext app)
          Removes the named directory.
 boolean setAttribute(AttributeName name, java.lang.String value, java.lang.String path, HttpServletRequest request, ServletContext app)
          Sets an attribute value.
 
Methods inherited from class com.caucho.servlets.webdav.AbstractPath
destroy, removeAttribute, rename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationPath

public ApplicationPath()
Method Detail

isFile

public boolean isFile(java.lang.String path,
                      HttpServletRequest request,
                      ServletContext app)
               throws java.io.IOException
Returns true if the named file is a file.

Specified by:
isFile in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

isDirectory

public boolean isDirectory(java.lang.String path,
                           HttpServletRequest request,
                           ServletContext app)
                    throws java.io.IOException
Returns true if the named file is a directory.

Specified by:
isDirectory in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

canRead

public boolean canRead(java.lang.String path,
                       HttpServletRequest request,
                       ServletContext app)
                throws java.io.IOException
Returns true if the file can be read.

Specified by:
canRead in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

exists

public boolean exists(java.lang.String path,
                      HttpServletRequest request,
                      ServletContext app)
               throws java.io.IOException
Returns true if the file exists.

Specified by:
exists in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getLength

public long getLength(java.lang.String path,
                      HttpServletRequest request,
                      ServletContext app)
               throws java.io.IOException
Returns the length of the named file.

Specified by:
getLength in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getLastModified

public long getLastModified(java.lang.String path,
                            HttpServletRequest request,
                            ServletContext app)
                     throws java.io.IOException
Returns the last modified time of the named file.

Specified by:
getLastModified in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getAttributeNames

public java.util.Iterator getAttributeNames(java.lang.String path,
                                            HttpServletRequest request,
                                            ServletContext app)
                                     throws java.io.IOException
Returns an iterator over the attribute names. Each attribute name is of the type AttributeName.

Overrides:
getAttributeNames in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

getAttribute

public java.lang.String getAttribute(AttributeName name,
                                     java.lang.String path,
                                     HttpServletRequest request,
                                     ServletContext app)
                              throws java.io.IOException
Returns an attribute value.

Overrides:
getAttribute in class AbstractPath
Parameters:
name - the attribute name
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

setAttribute

public boolean setAttribute(AttributeName name,
                            java.lang.String value,
                            java.lang.String path,
                            HttpServletRequest request,
                            ServletContext app)
                     throws java.io.IOException
Sets an attribute value.

Overrides:
setAttribute in class AbstractPath
Parameters:
name - the attribute name
value - the attribute value
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the setting was successful
Throws:
java.io.IOException

removeAttribute

public void removeAttribute(java.lang.String name,
                            java.lang.String path,
                            HttpServletRequest request,
                            ServletContext app)
                     throws java.io.IOException
Removes an attribute value.

Parameters:
name - the attribute name
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

list

public java.lang.String[] list(java.lang.String path,
                               HttpServletRequest request,
                               ServletContext app)
                        throws java.io.IOException
Returns a list of the files in the directory.

Specified by:
list in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Throws:
java.io.IOException

mkdir

public boolean mkdir(java.lang.String path,
                     HttpServletRequest request,
                     ServletContext app)
              throws java.io.IOException
Creates the named directory.

Specified by:
mkdir in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the creation succeeded.
Throws:
java.io.IOException

rmdir

public boolean rmdir(java.lang.String path,
                     HttpServletRequest request,
                     ServletContext app)
              throws java.io.IOException
Removes the named directory.

Specified by:
rmdir in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the remove succeeded.
Throws:
java.io.IOException

remove

public boolean remove(java.lang.String path,
                      HttpServletRequest request,
                      ServletContext app)
               throws java.io.IOException
Deletes the file

Specified by:
remove in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
true if the remove succeeded.
Throws:
java.io.IOException

openWrite

public java.io.OutputStream openWrite(java.lang.String path,
                                      HttpServletRequest request,
                                      ServletContext app)
                               throws java.io.IOException
Opens an OutputStream for writing.

Specified by:
openWrite in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
the output stream to the resource.
Throws:
java.io.IOException

openRead

public java.io.InputStream openRead(java.lang.String path,
                                    HttpServletRequest request,
                                    ServletContext app)
                             throws java.io.IOException
Opens an InputStream for reading

Specified by:
openRead in class AbstractPath
Parameters:
path - the requested relative path
request - the servlet request
app - the servlet context
Returns:
the input stream to the resource.
Throws:
java.io.IOException

getPath

protected Path getPath(java.lang.String path,
                       HttpServletRequest request,
                       ServletContext app)
                throws java.io.IOException
Returns the underlying path.

Throws:
java.io.IOException