CDAVRequest



Member Functions

CDAVRequest

   public:

CDAVRequest(class CDAVContext *ctx);

Constructs a CDAVRequest to operate against a particular DAV server.


CDAVRequest

   public:

CDAVRequest(CDAVRequest &req);

copy constructor


CancelTransaction

   public:

void CancelTransaction();

Cancel the current transaction; currently only works for PutResource and GetResource


CopyResource

   public:

ReqStatus CopyResource(LThread& inThread, ConstStr255Param source, ConstStr255Param destination, DAVTypes::Overwrite overwrite = DAVTypes::F, Boolean propsOnly = false, LListener *listener = NULL);

copy the contents of a resource. If the resource is a collection, the members of the collection are copied recursively by default.

Parameters

NameDescription
inThreadthe Thread performing the transaction
sourcethe original resource
destinationthe destination of the resource copy. Must be fully qualified with protocol, host, etc, and already URL encoded.
overwriteif set to DAVTypes::T, will overwrite a pre-existing resource. Defaulted to DAVTypes::F
propsOnlyif set to TRUE, only the directory is created and properties are copied. no recursive copy. Defaulted to false
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

CreatDirectory

   public:

ReqStatus CreateDirectory(LThread& inThread, ConstStr255Param resource, const char* lockToken = NULL, LListener *listener = NULL);

Create a new collection on the DAV server

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcea resource specifying the location of the new collection
lockTokena lock token for the parent of the new collection. If NULL no If header is sent. Defaulted to NULL
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

DeleteResource

   public:

ReqStatus DeleteResource(LThread& inThread, ConstStr255Param resource, LListener *listener = NULL);

Remove a resource from the DAV server

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcethe resource in question
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

DeleteResource

   public:

ReqStatus DeleteResource(LThread& inThread, CDAVItem& item, const char* lockToken=NULL, const char* pntLockToken=NULL, LListener *listener = NULL);

Remove a resource from the DAV server; if there is a lock owned by the current user, the opaquelocktoken is sent to the server

Parameters

NameDescription
inThreadthe Thread performing the transaction
itemthe item to be deleted in question
lockTokenan optional Lock Token for resource specified by item. Can be NULL (no lock will be sent to server)
pntLockTokenan optional Lock Token for immedate parent of the resource specified by item. Can be NULL (no lock will be sent to server)
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

DynBufferToFile

   public:

static Boolean DynBufferToFile(LDynamicBuffer *outBuf, LFile& outFile);

There is a bug in the function LDynamicBuffer::BufferToFile in the version of PowerPlant that shipped with CW5 where the resulting file is zero length if the buffer in the LDynamicBuffer object is a file and not a handle. This function reimplemts that function and fixes the defect.


FindAllProperties

   public:

ReqStatus FindAllProperties(LThread& inThread, ConstStr255Param resource, CDAVPropertyVector &props, LListener *listener = NULL);

Retrieve all known property definitions for a resource

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcethe resource in question
propsreference to return the property definitions
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

GetItemProperties

   public:

ReqStatus GetItemProperties(LThread& inThread, CDAVItem &resource, CDAVPropertyVector &props, LListener *listener=NULL);

For a given item, retrieve the specified set of properties

Parameters

NameDescription
resourcethe resource in question
propslist of properties to retrieve
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

GetLastResponse

   public:

SInt32 GetLastResponse() {return mLastResponse;};

Returns the HTTP response code from the last request operation.


GetResource

   public:

ReqStatus GetResource(LThread& inThread, ConstStr255Param resource, const FSSpec &outputSpec, LListener *listener = NULL);

downloads a resource on the DAV server to an FSSpec

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcethe resource to download
outputSpecthe FSSpec specifying the resource's destination
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

GetResourceExists

   public:

ReqStatus GetResourceExists(LThread& inThread, ConstStr255Param resource, Boolean& outExists, LListener *listener=NULL);

Query server to see if a resource exists. Implemented as a propfind.

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcethe resource in question
outExistsoutput parameter
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

GetServerOptions

   public:

ReqStatus GetServerOptions(LThread& inThread, ConstStr255Param resource, CDAVInfo &outOptions, Boolean showDlog=false, LListener *listener = NULL);

Query a server to determine if it supports various DAV and DASL operations

Parameters

NameDescription
inThreadthe thread performing the operation
resourcethe resource in question
outOptionsa reference to a CDAVOptions object; output parameter
showDlogshow a dialog on error, defaulted to false
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

ListDirectory

   public:

ReqStatus ListDirectory(LThread& inThread, ConstStr255Param resource, CDAVItemVector &children, CDAVPropertyVector &props, class LListener *listener=NULL, DAVTypes::PropertyDepth depth = DAVTypes::ONE );

get the contents of a collection

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcethe resource in question
childrenreference to return the collection members
propslist of properties to retrieve
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

ListLocks

   public:

ReqStatus ListLocks(LThread& inThread, ConstStr255Param resource, LListener *listener = NULL);

list all locks under a resource

Parameters

NameDescription
inThreadthe Thread performing the transaction
resourcethe resource in question
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

LockResource

   public:

ReqStatus LockResource(LThread& inThread, CDAVItem &item, CDAVItem::LockScope lockScope, const char* owner=NULL, SInt32 timeout_seconds=0, CDAVItem::LockType lockType = CDAVItem::WRITE, LListener *listener = NULL);

Given an item, create a lock for the specified resource. Implies a Depth of Zero

Parameters

NameDescription
inThreadthe Thread performing the transaction
itemthe resource to be locked
lockScopethe scope of the lock (exclusive or shared)
timeout_secondsnumber of seconds until lock times out. If this is set to 0, then Infinite is requested. Note that according to the DAV standard, a server is not required to honor this request. Default is 0.
ownera href to optionally identify the lock owner. This may be NULL. default is NULL.
lockTypethe type of the lock. At this time, DAV only specifies a WRITE lock, hence the default value or WRITE
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

MoveResource

   public:

ReqStatus MoveResource(LThread& inThread, ConstStr255Param source , ConstStr255Param destination, DAVTypes::Overwrite overwrite = DAVTypes::F, LListener *listener = NULL);

moves the contents of a resource. If the resource is a collection, the members of the collection are moved recursively.

Parameters

NameDescription
inThreadthe Thread performing the transaction
sourcethe original resource
destinationthe destination of the resource copy. Must be fully qualified with protocol, host, etc.
overwriteif set to DAVTypes::T, will overwrite a pre-existing resource. Defaulted to DAVTypes::F
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

PutResource

   public:

ReqStatus PutResource(LThread& inThread, ConstStr255Param destination, const FSSpec &inputSpec, const char* locktoken = NULL, const char* pntLockToken = NULL, Boolean *itemCreated=NULL, LListener *listener=NULL);

uploads a FSSpec to location specified on the DAV server

Parameters

NameDescription
inThreadthe Thread performing the transaction
destinationthe destination of the file
inputSpecthe FSSpec to upload
locktokena Lock token to optionally use when uploading the file. Can be NULL
pntLockTokena Lock token on the parent URI to optionally use when uploading the file. Can be NULL. Defaulted to NULL.
itemCreatedif a new resource was created as part of this transaction, this is set to true; otherwise (on an HTTP 204), it's set to false. Can be NULL. Defaulted to NULL.
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

RemoveItemProperty

   public:

ReqStatus RemoveItemProperty(LThread& inThread, CDAVItem &resource, CDAVProperty &prop, LListener *listener=NULL);

For a given item, set the specified set of property

Parameters

NameDescription
resourcethe resource in question
propthe propertiy to set
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

SetItemProperty

   public:

ReqStatus SetItemProperty(LThread& inThread, CDAVItem &resource, CDAVProperty &prop, std::string &propVal, LListener *listener=NULL);

For a given item, set the specified set of property

Parameters

NameDescription
resourcethe resource in question
propthe propertiy to set
propValthe property's value; must be PCDATA or well formed XML
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

UnlockResource

   public:

ReqStatus UnlockResource(LThread& inThread, const char* uri, const char* lockToken, LListener *listener = NULL);



Parameters

NameDescription
inThreadthe Thread performing the transaction
urithe resource to be unlocked
lockTokenthe lock token for the specified URL.
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

UnlockResource

   public:

ReqStatus UnlockResource(LThread& inThread, CDAVItem &item, LListener *listener = NULL);



Parameters

NameDescription
inThreadthe Thread performing the transaction
itemthe item to unlock.
listenera listener on the event, defaulted to NULL
Result: One of the enum ReqStatus

~CDAVRequest

   public:

virtual ~CDAVRequest();

Destructor


Member Data

DAV

public:
  enum  ReqStatus  {
  SUCCESS,
  WARNING,
  FAILURE,
  CANCEL,
  XMLERROR,
  UNKNOWN
  };

transaction response codes

Constants

NameDescription
SUCCESSTransaction successful
WARNINGTransaction succeeded but with warnings
FAILURETransaction failed.
CANCELTransaction canceled.
XMLERRORTransport of the request succeeded, but there was an error in parsing the XML sent from the server.
UNKNOWNUnknown failure. Transaction not successful.

© 1999-2000, Thomas Bednarz, Jr. — (Last Updated 7/16/2000)