VirtualFileWorkItem¶
-
class
kanzi::connect::VirtualFileWorkItem: public ConnectWorkItem¶ HTTP Virtual File specific work item.
Encapsulates effectively one request where incoming data is the URI and outgoing data is the result in three possible forms (data-as-is, full-path-to-file, redirect-to-url).
Public Functions
-
VirtualFileWorkItem(int32_t priority, string uri)¶ Constructor.
- Parameters
priority: Priority of the work item.
-
~VirtualFileWorkItem()¶ C++ destructor.
-
int
getHandle() const¶ Retrieve handle.
- Return
handle
-
const string &
getMime() const¶ Retrieve MIME type.
- Return
The MIME type.
-
const string
getResultAsData() const¶ Retrieve result file content.
- Return
result data.
-
const string
getResultAsFile() const¶ Retrieves the filepath.
- Return
filepath
-
const string
getResultAsURI() const¶ Retrieves the uri.
- Return
uri
-
shared_ptr<VirtualfileServiceConcept::Session>
getSession() const¶ Retrieve session.
- Return
The retrieved session.
-
const string &
getUri() const¶ Retrieve the uri where from the content is to be retrieved.
- Return
uri
-
bool
hasResultAsData() const¶ Determine whether result file content is set.
- Return
true if result file content is in place.
-
bool
hasResultAsFile() const¶ Determine whether filepath is defined.
- Return
true if filepath type.
-
bool
hasResultAsUri() const¶ Determine whether uri is defined.
- Return
true if defined.
-
void
notifyComplete()¶ Completes the pending object.
-
void
setHandle(int handle)¶ Store the handle.
- Parameters
handle: handle to store.
-
void
setMime(const string &mime)¶ Store the MIME type of the returned object.
- Parameters
mime: The MIME type.
-
void
setResultAsData(const string &fileContent)¶ Sets the result file content.
- Parameters
fileContent: buffer containing the dat.a
-
void
setResultAsData(const unsigned char *bytes, size_t length)¶ Sets result file content as a binary (can also be text, obviously)
- Parameters
bytes: raw bufferlength: size of data in buffer
-
void
setResultAsFile(const string &filename)¶ Sets result as a file.
- Parameters
filename: full path to file.
-
void
setResultAsURI(const string &uri)¶ Sets uri.
- Parameters
uri: the uri to set.
Store session.
- Parameters
session: The session to store.
-
bool
waitUntilComplete(int ms)¶ Waits for this object to be completed.
- Parameters
ms: how long to wait max.
-