VirtualFileRequestHandler¶
-
class
kanzi::connect
::
VirtualFileRequestHandler
: public CivetHandler¶ VirtualFileRequestHandler implements the CivetHandler for defined local URI.
Public Functions
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.
-
virtual
~VirtualFileRequestHandler
()¶ Virtual desctructor for object cleanup.
-
VirtualFileProvider *
getProvider
() const¶ retrieve configured provider
- Returns
pointer to provider. can be nullptr. ownership not transfered.
-
shared_ptr<VirtualfileServiceConcept::Session>
getSession
() const¶ retrieve configured session
- Returns
pointer to session. can be nullptr. ownership not transfered.
-
virtual bool
handleGet
(CivetServer *server, struct mg_connection *conn)¶ Handles GET requests for the specified local URI.
- Parameters
server – Server to which the request is attached
conn – Civet connection entity that is attached to this particular request.
- Returns
Boolean telling the Civet framework whether a message was handled, always true.
-
virtual bool
handlePost
(CivetServer *server, struct mg_connection *conn)¶ Handles POST requests for the specified local URI.
- Parameters
server – Server to which the request is attached
conn – Civet connection entity that is attached to this particular request.
- Returns
Boolean telling the Civet framework whether a message was handled, always true.
-
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
-
virtual bool
processFileReadRequest
(struct mg_connection *connection) = 0¶ Invoked to handle a content request.
- Parameters
connection – The civet connection.
-
virtual bool
processPostContentRequest
(struct mg_connection *connection) = 0¶ Invoked to handle HTTP post request.
- Parameters
connection – The civet connection
- Returns
If request is handled, true, otherwise false.
-
virtual bool