libcex
1.0.0
Modern C++11 embedded webserver library
|
Represents a single middleware. More...
#include <core.hpp>
Public Types | |
enum | Flags { fMatchContain = 0x001, fMatchCompare = 0x002, fMatchRegex = 0x004, fMatching = 0x00F } |
Flags for controlling the path matching behaviour. More... | |
enum | Type { tpStandard, tpUpload } |
Type of middleware. More... | |
Public Member Functions | |
Middleware (const char *path, MiddlewareFunction func, int method=na, int flags=fMatchContain) | |
Constructs a new middleware with the given parameters. More... | |
Middleware (const char *path, UploadFunction func, int method=na, int flags=fMatchContain) | |
bool | match (Request *req) |
const char * | getPath () |
Friends | |
class | Server |
Represents a single middleware.
Contains the middleware function and its configuration (path, method, matching flags).
Flags for controlling the path matching behaviour.
Enumerator | |
---|---|
fMatchContain | Match if the request's URL contains the Middleware path |
fMatchCompare | Match if the request's URL equals the Middleware path |
fMatchRegex | Perform a regular expression match with the Middleware path as pattern |
Type of middleware.
Enumerator | |
---|---|
tpStandard | Standard Middleware |
tpUpload | Middleware to handle (file-)uploads |
cex::Middleware::Middleware | ( | const char * | path, |
MiddlewareFunction | func, | ||
int | method = na , |
||
int | flags = fMatchContain |
||
) |
Constructs a new middleware with the given parameters.
path | The path the URL shall be attached to. If path is NULL, all URLs will match |
func | The MiddlewareFunction which is called when the request matches |
method | The HTTP method the request must match |
flags | Matching flags which control the path matching behaviour |