|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abstracthorizon.danube.http.BaseReflectionHTTPConnectionHandler org.abstracthorizon.danube.webdav.BaseWebDAVResourceConnectionHandler
public class BaseWebDAVResourceConnectionHandler
Base WebDAV resource connection handler. This class uses supplied ResourceAdapter
to read and write resource to/from.
Field Summary | |
---|---|
protected ResourceAdapter |
adapter
Resource adapter to be used |
protected int |
bufferSize
Internal buffer size |
protected CollectionHTMLRenderer |
collectionRenderer
Renderer of collection of items if GET method is invoked on a collection resource |
protected boolean |
readOnly
Flag denoting will this class allow resources to be changed or not |
static Status |
STATUS_FAILED_DEPENDENCY
Status 424 Failed Dependency |
static Status |
STATUS_LOCKED
Status 423 Locked |
Fields inherited from class org.abstracthorizon.danube.http.BaseReflectionHTTPConnectionHandler |
---|
cachedMethods, errorResponse, noDefaultHead, noDefaultTrace |
Constructor Summary | |
---|---|
BaseWebDAVResourceConnectionHandler()
Constructor |
|
BaseWebDAVResourceConnectionHandler(ResourceAdapter webDAVAdapter)
Constructor |
Method Summary | |
---|---|
protected void |
cacheMethods()
Caches methods for quick invocation. |
protected Ranges |
collectRange(HTTPConnection connection)
Collects range from the "Range" header. |
protected Timeout[] |
collectTimeouts(HTTPConnection connection)
Collects timeouts from the "Timeout" header |
protected boolean |
deleteLeafImpl(MultiStatus multiStatus,
String path,
Object resource)
Deletes a leaf (non-collection resource) |
protected boolean |
deleteRecursive(MultiStatus multiStatus,
String path,
Object resource)
Deletes resouces recursively |
protected Object |
findResource(HTTPConnection httpConnection)
Returns a resource. |
protected void |
fixUnknownPropsResponse(MultiStatus multiStatus)
Patch to fix response without "known"l properties |
CollectionHTMLRenderer |
getCollectionHTMLRenderer()
Returns collection HTML renderer |
ResourceAdapter |
getWebDAVResourceAdapter()
Returns WebDAV resource adapter |
protected boolean |
isLockedRecursive(LockingMechanism lockingMechanism,
IF lockDetails,
MultiStatus multiStatus,
HTTPConnection httpConnection,
Object resource,
String path)
Checks recursively if resource is locked and all of it's children. |
boolean |
isReadOnly()
Returns read only flag |
protected boolean |
lockImpl(Response response,
Lock lock,
LockingMechanism lockingMechanism,
LockInfo lockInfo,
Object owner,
boolean recursive,
Object resource)
Locks the resource |
protected boolean |
lockRecursive(MultiStatus multiStatus,
Lock lock,
LockingMechanism lockingMechanism,
LockInfo lockInfo,
Object owner,
Object resource,
String path)
Locks resource recursively. |
void |
methodCOPY(HTTPConnection httpConnection)
Implements copy method |
void |
methodDELETE(HTTPConnection httpConnection)
Following is hard to be maintained and is not followed stictly in this implementation: |
void |
methodGET(HTTPConnection httpConnection)
GET method implementation |
void |
methodHEAD(HTTPConnection httpConnection)
Implementation of the HEAD method. |
void |
methodLOCK(HTTPConnection httpConnection)
Implements LOCK method. |
void |
methodMKCOL(HTTPConnection httpConnection)
Implements MKCOL method (making collection). |
void |
methodMOVE(HTTPConnection httpConnection)
Moves resource |
void |
methodOPTIONS(HTTPConnection httpConnection)
This method adds DAV: 1,2 header. |
void |
methodPROPFIND(HTTPConnection httpConnection)
Implements PROPFIND method |
void |
methodPROPPATCH(HTTPConnection httpConnection)
Implements PROPPATH method |
void |
methodPUT(HTTPConnection httpConnection)
Implements PUT method |
void |
methodUNLOCK(HTTPConnection httpConnection)
Implements UNLOCK method. |
protected void |
obtainProps(Response response,
Object resource,
PropFind propFind)
Obtain properties of a given resource |
protected void |
obtainPropsRecursive(MultiStatus multiStatus,
Object resource,
PropFind propFind,
String path)
Obtain properties recursively |
protected Object |
readRequestXML(Adaptable adaptable,
Class<?> expectedClass)
Reads request XML strcture and parses it returning an object based on WebDAVXMLHandler . |
void |
setCollectionHTMLRenterer(CollectionHTMLRenderer collectionHTMLRenderer)
Sets collection HTML renderer |
void |
setReadOnly(boolean readOnly)
Sets read only flag |
void |
setWebDAVResourceAdapter(ResourceAdapter webDAVAdapter)
Sets WebDAV resource adapter |
protected void |
transmitResource(HTTPConnection httpConnection,
Object resource,
Adaptable output,
Ranges ranges)
Transmits resource. |
protected void |
updateProps(MultiStatus multiStatus,
Object resource,
int depth,
PropertyUpdate propertyUpdate)
Updates properties |
protected void |
updateProps(Response response,
Object resource,
PropertyUpdate propertyUpdate)
Updates properties of a given resource (leaf) |
protected void |
updatePropsRecursive(MultiStatus multiStatus,
Object resource,
PropertyUpdate propertyUpdate,
String path)
Updates properties recursively |
Methods inherited from class org.abstracthorizon.danube.http.BaseReflectionHTTPConnectionHandler |
---|
getErrorResponse, getNoDefaultHead, getNoDefaultTrace, handleConnection, invokeMethod, methodTRACE, returnError, returnSimpleContent, setErrorResponse, setNoDefaultHead, setNoDefaultTrace, updateDefaultHeadMethod, updateDefaultTraceMethod |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Status STATUS_LOCKED
public static final Status STATUS_FAILED_DEPENDENCY
protected ResourceAdapter adapter
protected int bufferSize
protected CollectionHTMLRenderer collectionRenderer
protected boolean readOnly
Constructor Detail |
---|
public BaseWebDAVResourceConnectionHandler()
public BaseWebDAVResourceConnectionHandler(ResourceAdapter webDAVAdapter)
webDAVAdapter
- web dav adapterMethod Detail |
---|
public ResourceAdapter getWebDAVResourceAdapter()
public void setWebDAVResourceAdapter(ResourceAdapter webDAVAdapter)
webDAVAdapter
- WebDAV resourcepublic CollectionHTMLRenderer getCollectionHTMLRenderer()
public void setCollectionHTMLRenterer(CollectionHTMLRenderer collectionHTMLRenderer)
collectionHTMLRenderer
- collection HTML rendererpublic boolean isReadOnly()
public void setReadOnly(boolean readOnly)
readOnly
- read only flagprotected Object findResource(HTTPConnection httpConnection)
httpConnection
- http connection
protected void cacheMethods()
null
).
cacheMethods
in class BaseReflectionHTTPConnectionHandler
public void methodOPTIONS(HTTPConnection httpConnection)
methodOPTIONS
in class BaseReflectionHTTPConnectionHandler
httpConnection
- connectionpublic void methodGET(HTTPConnection httpConnection)
httpConnection
- connectionprotected void transmitResource(HTTPConnection httpConnection, Object resource, Adaptable output, Ranges ranges)
httpConnection
- connectionresource
- resource to be usedoutput
- adaptable to be checked for the output streamranges
- ranges. Can be null
.public void methodHEAD(HTTPConnection httpConnection)
methodHEAD
in class BaseReflectionHTTPConnectionHandler
httpConnection
- connectionpublic void methodPUT(HTTPConnection httpConnection)
httpConnection
- connectionpublic void methodDELETE(HTTPConnection httpConnection)
Following is hard to be maintained and is not followed stictly in this implementation:
" If any resource identified by a member URI cannot be deleted then all of the member's ancestors MUST NOT be deleted, so as to maintain namespace consistency. "
Delete will stop at the first problem but deleted resources will remain deleted.
httpConnection
- protected boolean deleteRecursive(MultiStatus multiStatus, String path, Object resource)
multiStatus
- multi status responsepath
- current pathresource
- resource
true
if successfulprotected boolean deleteLeafImpl(MultiStatus multiStatus, String path, Object resource)
multiStatus
- multi status responsepath
- current pathresource
- resource
true
if successfulpublic void methodPROPFIND(HTTPConnection httpConnection)
httpConnection
- http connectionprotected void obtainPropsRecursive(MultiStatus multiStatus, Object resource, PropFind propFind, String path)
multiStatus
- multi status responseresource
- resourcepropFind
- propfind structurepath
- current pathprotected void obtainProps(Response response, Object resource, PropFind propFind)
response
- single response structureresource
- resourcepropFind
- propfind structurepublic void methodPROPPATCH(HTTPConnection httpConnection)
httpConnection
- connectionprotected void updateProps(MultiStatus multiStatus, Object resource, int depth, PropertyUpdate propertyUpdate)
multiStatus
- multi status responseresource
- resourcedepth
- depth structurepropertyUpdate
- propertyupdate structureprotected void updatePropsRecursive(MultiStatus multiStatus, Object resource, PropertyUpdate propertyUpdate, String path)
multiStatus
- multi status responseresource
- resourcepropertyUpdate
- propertyupdate structurepath
- current pathprotected void updateProps(Response response, Object resource, PropertyUpdate propertyUpdate)
response
- single responseresource
- resourcepropertyUpdate
- propertyupdate structureprotected void fixUnknownPropsResponse(MultiStatus multiStatus)
multiStatus
- multi status responsepublic void methodMKCOL(HTTPConnection httpConnection)
httpConnection
- connectionpublic void methodCOPY(HTTPConnection httpConnection)
httpConnection
- connectionpublic void methodMOVE(HTTPConnection httpConnection)
Note: property behaviour is ignored in this implementation!
httpConnection
- connectionpublic void methodLOCK(HTTPConnection httpConnection)
httpConnection
- connectionprotected boolean lockRecursive(MultiStatus multiStatus, Lock lock, LockingMechanism lockingMechanism, LockInfo lockInfo, Object owner, Object resource, String path)
multiStatus
- multi status responselock
- locklockingMechanism
- locking mechanismlockInfo
- lock info structureowner
- ownerresource
- resourcepath
- path
true
if locking succeededprotected boolean lockImpl(Response response, Lock lock, LockingMechanism lockingMechanism, LockInfo lockInfo, Object owner, boolean recursive, Object resource)
response
- single responselock
- locklockingMechanism
- locking mechanismlockInfo
- lockinfo structureowner
- ownerrecursive
- is recursiveresource
- resource
true
if succeededpublic void methodUNLOCK(HTTPConnection httpConnection)
httpConnection
- connectionprotected boolean isLockedRecursive(LockingMechanism lockingMechanism, IF lockDetails, MultiStatus multiStatus, HTTPConnection httpConnection, Object resource, String path)
lockingMechanism
- locking mechanismlockDetails
- lock detailsmultiStatus
- multi status responsehttpConnection
- connectionresource
- resourcepath
- current path
true
if resource is lockedprotected Ranges collectRange(HTTPConnection connection)
connection
- http connection
Ranges
or null
protected Timeout[] collectTimeouts(HTTPConnection connection)
connection
- http connection
Timeout
structure or null
protected Object readRequestXML(Adaptable adaptable, Class<?> expectedClass) throws SAXException
WebDAVXMLHandler
.
adaptable
- adaptable object to be used for obtaining input streamexpectedClass
- expected class
null
SAXException
- if there was an expcetion while parsing
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |