libcex  1.0.0
Modern C++11 embedded webserver library
Public Types | Public Member Functions | Friends | List of all members
cex::Middleware Class Reference

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
 

Detailed Description

Represents a single middleware.

Contains the middleware function and its configuration (path, method, matching flags).

Member Enumeration Documentation

◆ 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

Type of middleware.

Enumerator
tpStandard 

Standard Middleware

tpUpload 

Middleware to handle (file-)uploads

Constructor & Destructor Documentation

◆ Middleware()

cex::Middleware::Middleware ( const char *  path,
MiddlewareFunction  func,
int  method = na,
int  flags = fMatchContain 
)

Constructs a new middleware with the given parameters.

Parameters
pathThe path the URL shall be attached to. If path is NULL, all URLs will match
funcThe MiddlewareFunction which is called when the request matches
methodThe HTTP method the request must match
flagsMatching flags which control the path matching behaviour

The documentation for this class was generated from the following files: