8 #ifndef MOD_SERVLET_FILTER_H
9 #define MOD_SERVLET_FILTER_H
16 #include <servlet/request.h>
17 #include <servlet/response.h>
18 #include <servlet/context.h>
25 #define FILTER_EXPORT(factoryName, className) extern "C" servlet::http_filter* factoryName() { return new className{}; }
203 template <
typename KeyType>
238 #endif // MOD_SERVLET_FILTER_H
virtual void do_filter(http_request &request, http_response &response)=0
Causes the next filter in the chain to be invoked, or if the calling filter is the last filter in the...
A filter is an object that performs filtering tasks on either the request to a resource (a servlet or...
Definition: filter.h:86
const std::map< std::string, std::string, std::less<> > & get_init_parameters() const
Returns the all of the filter's initialization parameters as an tree_map of std::string objects...
Definition: filter.h:188
const std::string & get_filter_name() const
Get the name of the filter.
Definition: context.h:347
Defines an object to provide client request information to a servlet.
Definition: request.h:35
const filter_config & get_filter_config() const
Returns a filter_config object, which contains initialization and startup parameters for this filter...
Definition: filter.h:164
Optional reference implementation.
Definition: optional.h:221
const std::map< std::string, std::string, std::less<> > & get_init_parameters()
Returns all the filter's initialization parameters as a tree_map.
Definition: context.h:380
virtual void init()
A convenience method which can be overridden so that there's no need to call init(filter_config).
Definition: filter.h:101
A filter_chain is an object provided by the servlet container to the developer giving a view into the...
Definition: filter.h:220
optional_ref< const std::string > get_init_parameter(const KeyType &name) const
Returns an optional std::string containing the value of the named initialization parameter, or null if the parameter does not exist.
Definition: filter.h:204
const std::string & get_filter_name() const
Returns the name of this filter instance.
Definition: filter.h:174
A filter configuration object used by a servlet container to pass information to a filter during init...
Definition: context.h:320
optional_ref< const std::string > get_init_parameter(const KeyType &key)
Returns a std::string containing the value of the named initialization parameter, or empty_reference ...
Definition: context.h:371
Defines an object to assist a servlet in sending a response to the client.
Definition: response.h:33
virtual void do_filter(http_request &request, http_response &response, filter_chain &chain)=0
The do_filter method of the http_filter is called by the container each time a request/response pair ...