VirtualFileRequestHandler

class kanzi::connect::VirtualFileRequestHandler : public CivetHandler

VirtualFileRequestHandler implements the CivetHandler for defined local URI.

Public Functions

VirtualFileRequestHandler(const string &path, ServiceInterface &sif, shared_ptr<VirtualfileServiceConcept::Session> session)

Constructs an object from a Session.

Effectively this type of object is created for remotely connecting clients

Parameters
  • path: the path

  • sif: service interface where to requests are routed

  • session: service session.

VirtualFileRequestHandler(const string &path, ServiceInterface &sif, VirtualFileProvider *provider)

Construct an object and binds it to a local file provider.

Parameters
  • path: the path

  • sif: service interface where to requests are routed.

  • provider: pointer that effectively can handle the requests.

~VirtualFileRequestHandler()

Virtual desctructor for object cleanup.

VirtualFileProvider *getProvider() const

retrieve configured provider

Return

pointer to provider. can be nullptr. ownership not transfered.

shared_ptr<VirtualfileServiceConcept::Session> getSession() const

retrieve configured session

Return

pointer to session. can be nullptr. ownership not transfered.

bool handleGet(CivetServer *server, struct mg_connection *conn)

Handles GET requests for the specified local URI.

Return

Boolean telling the Civet framework whether a message was handled, always true.

Parameters
  • server: Server to which the request is attached

  • conn: Civet connection entity that is attached to this particular request.

bool handlePost(CivetServer *server, struct mg_connection *conn)

Handles POST requests for the specified local URI.

Return

Boolean telling the Civet framework whether a message was handled, always true.

Parameters
  • server: Server to which the request is attached

  • conn: Civet connection entity that is attached to this particular request.

const string &localUri()

Local URI that is handled by this instance.

class ServiceInterface

Inner class to define a callback interface from this Civet specific handler class.

Subclassed by VirtualFileService

Public Functions

bool processFileReadRequest(struct mg_connection *connection) = 0

Invoked to handle a content request.

Parameters
  • connection: The civet connection.

bool processPostContentRequest(struct mg_connection *connection) = 0

Invoked to handle HTTP post request.

Return

If request is handled, true, otherwise false.

Parameters
  • connection: The civet connection