VirtualFileResponse

class kanzi::connect::VirtualFileResponse

Response object that is used by the clients to complete the file request.

Public Functions

VirtualFileResponse(VirtualFileLocalResponseInterface *manager, VirtualFileWorkItemSharedPtr workItem, unsigned int blockSize)

C++ constructor used by the Local clients.

Parameters
  • manager: pointer to virtualfilemanager instance that is used to complete the operation.

  • workItem: work item used to carry the response information.

  • blockSize: In what size pieces to send the file if a buffer is to be transferred

VirtualFileResponse(VirtualFileRemoteResponseInterface *responseInterface, int handle, unsigned int blockSize)

C++ constructor used by the remote clients.

Parameters
  • responseInterface: service interface used to deliver responses

  • handle: unique request handle - passed as argument.

  • blockSize: In what size pieces to send the file if a buffer is to be transferred

~VirtualFileResponse()

virtual destructor.

bool deferredCompletionRequested() const

Retrieve the deferred completion status.

Return

true if deferred completion has been requested.

void provideAsFileThroughHttp(const string &filepath)

Provide requested file as existing file in filesystem through http protocol.

Parameters
  • filepath: path to file to return.

void provideAsHttpContent(const string &mime, const unsigned char *blob, size_t length)

Provide requested file as inline content through http.

Parameters
  • mime: mime type of for the content provided

  • blob: raw block of data to report

  • length: size of raw data.

void provideAsRedirectUri(const string &uri)

Return response as a redirect to another uri.

Parameters
  • uri: where should the client be redirected.

void provideFileDirectly(const string &uri, vector<char> &buffer)

Provide response as file contents through the connection adapters.

Parameters
  • uri: Identifies the file

  • buffer: The data to provide as file, this data is consumed

void requestDeferredCompletion()

Requests deferred completion for the object.

bool wasProvided() const

Can be used to example whether any of the provide functions have been called.

Return

true if data has been “provided”.