com.ettrema.http.fs
Class FsDirectoryResource

java.lang.Object
  extended by com.ettrema.http.fs.FsResource
      extended by com.ettrema.http.fs.FsDirectoryResource
All Implemented Interfaces:
CollectionResource, CopyableResource, DeletableResource, DigestResource, GetableResource, LockableResource, LockingCollectionResource, MakeCollectionableResource, MoveableResource, PropFindableResource, PutableResource, Resource

public class FsDirectoryResource
extends FsResource
implements MakeCollectionableResource, PutableResource, CopyableResource, DeletableResource, MoveableResource, PropFindableResource, LockingCollectionResource, GetableResource

Represents a directory in a physical file system.


Constructor Summary
FsDirectoryResource(java.lang.String host, FileSystemResourceFactory factory, java.io.File dir)
           
 
Method Summary
 java.lang.String checkRedirect(Request request)
          Will redirect if a default page has been specified on the factory
 Resource child(java.lang.String name)
           
 LockToken createAndLock(java.lang.String name, LockTimeout timeout, LockInfo lockInfo)
           
 CollectionResource createCollection(java.lang.String name)
           
 Resource createNew(java.lang.String name, java.io.InputStream in, java.lang.Long length, java.lang.String contentType)
           
protected  void doCopy(java.io.File dest)
           
 java.util.List<? extends Resource> getChildren()
           
 java.lang.Long getContentLength()
           
 java.lang.String getContentType(java.lang.String accepts)
           
 java.lang.Long getMaxAgeSeconds(Auth auth)
           
 void sendContent(java.io.OutputStream out, Range range, java.util.Map<java.lang.String,java.lang.String> params, java.lang.String contentType)
          Will generate a listing of the contents of this directory, unless the factory's allowDirectoryBrowsing has been set to false.
 
Methods inherited from class com.ettrema.http.fs.FsResource
authenticate, authenticate, authorise, compareTo, copyTo, delete, getCreateDate, getCurrentLock, getFile, getModifiedDate, getName, getRealm, getUniqueId, isDigestAllowed, lock, moveTo, refreshLock, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bradmcevoy.http.CopyableResource
copyTo
 
Methods inherited from interface com.bradmcevoy.http.DeletableResource
delete
 
Methods inherited from interface com.bradmcevoy.http.MoveableResource
moveTo
 
Methods inherited from interface com.bradmcevoy.http.PropFindableResource
getCreateDate
 
Methods inherited from interface com.bradmcevoy.http.LockableResource
getCurrentLock, lock, refreshLock, unlock
 
Methods inherited from interface com.bradmcevoy.http.Resource
authenticate, authorise, getModifiedDate, getName, getRealm, getUniqueId
 

Constructor Detail

FsDirectoryResource

public FsDirectoryResource(java.lang.String host,
                           FileSystemResourceFactory factory,
                           java.io.File dir)
Method Detail

createCollection

public CollectionResource createCollection(java.lang.String name)
Specified by:
createCollection in interface MakeCollectionableResource

child

public Resource child(java.lang.String name)
Specified by:
child in interface CollectionResource

getChildren

public java.util.List<? extends Resource> getChildren()
Specified by:
getChildren in interface CollectionResource

checkRedirect

public java.lang.String checkRedirect(Request request)
Will redirect if a default page has been specified on the factory

Specified by:
checkRedirect in interface Resource
Parameters:
request -
Returns:

createNew

public Resource createNew(java.lang.String name,
                          java.io.InputStream in,
                          java.lang.Long length,
                          java.lang.String contentType)
                   throws java.io.IOException
Specified by:
createNew in interface PutableResource
Throws:
java.io.IOException

doCopy

protected void doCopy(java.io.File dest)
Specified by:
doCopy in class FsResource

createAndLock

public LockToken createAndLock(java.lang.String name,
                               LockTimeout timeout,
                               LockInfo lockInfo)
                        throws NotAuthorizedException
Specified by:
createAndLock in interface LockingCollectionResource
Throws:
NotAuthorizedException

sendContent

public void sendContent(java.io.OutputStream out,
                        Range range,
                        java.util.Map<java.lang.String,java.lang.String> params,
                        java.lang.String contentType)
                 throws java.io.IOException,
                        NotAuthorizedException
Will generate a listing of the contents of this directory, unless the factory's allowDirectoryBrowsing has been set to false. If so it will just output a message saying that access has been disabled.

Specified by:
sendContent in interface GetableResource
Parameters:
out -
range -
params -
contentType -
Throws:
java.io.IOException
NotAuthorizedException

getMaxAgeSeconds

public java.lang.Long getMaxAgeSeconds(Auth auth)
Specified by:
getMaxAgeSeconds in interface GetableResource

getContentType

public java.lang.String getContentType(java.lang.String accepts)
Specified by:
getContentType in interface GetableResource

getContentLength

public java.lang.Long getContentLength()
Specified by:
getContentLength in interface GetableResource


Copyright © 2011. All Rights Reserved.