CppCMS
|
This class represents application's mount point or the rule on which specific application is selected to process the query. More...
#include <cppcms/mount_point.h>
Public Types | |
enum | selection_type { match_path_info, match_script_name } |
Public Member Functions | |
booster::regex | host () const |
booster::regex | script_name () const |
booster::regex | path_info () const |
int | group () const |
selection_type | selection () const |
void | host (booster::regex const &) |
void | script_name (booster::regex const &) |
void | path_info (booster::regex const &) |
void | group (int) |
void | selection (selection_type) |
std::pair< bool, std::string > | match (std::string const &h, std::string const &s, std::string const &p) const |
std::pair< bool, std::string > | match (char const *h, char const *s, char const *p) const |
mount_point () | |
~mount_point () | |
Destructor. | |
mount_point (mount_point const &) | |
mount_point const & | operator= (mount_point const &) |
mount_point (std::string const &path, int group) | |
mount_point (std::string const &script) | |
mount_point (std::string const &script, std::string const &path, int group) | |
mount_point (selection_type sel, std::string const &selected_part, int group) | |
mount_point (selection_type sel, std::string const &non_selected_part) | |
mount_point (selection_type sel, std::string const &non_selected_part, std::string const &selected_part, int group) | |
mount_point (selection_type sel, booster::regex const &http_host, booster::regex const &script, booster::regex const &path, int group) | |
This class represents application's mount point or the rule on which specific application is selected to process the query.
It is used by applications_pool class for mounting applications, and by forwarding managers to match forwarding requests
Type that describes what parameter should be passed to application::main(std::string) function
When the application selected specific string is passed for matching with application's member function or application's children. This can be CGI variable PATH_INFO or SCRIPT_NAME or their substring taken with regular expression.
If selection is match_path_info then PATH_INFO passed for matching, otherwide SCRIPT_NAME is used for matching.
For example if your service works with SCRIPT_NAME /app and the URL is pointing to /app/page/20 such as SCRIPT_NAME is "/app" and PATH_INFO is "/page/20" then the last one will be used for dispatching by cppcms::application::main function.
But you may also work with "*.cgi" style URL if your application process all queries comping from "*.cgi" and you have "dummy scripts" at "/cgi-bin/users.cgi" and "/cgi-bin/app.cgi" and you want to match against SCRIPT_NAME rather then PATH_INFO you can use match_script_name option and the script name will be used for matching.
Enumerator | |
---|---|
match_path_info |
Pass PATH_INFO to applications. |
match_script_name |
Pass SCRIPT_NAME to applications. |
cppcms::mount_point::mount_point | ( | ) |
Create default mount point, it uses PATH_INFO for url-dispatching and gives no restriction on URL
cppcms::mount_point::mount_point | ( | mount_point const & | ) |
Copy constructor
cppcms::mount_point::mount_point | ( | std::string const & | path, |
int | group | ||
) |
Create a mount point that checks PATH_INFO only and passes matched group for dispatching
cppcms::mount_point::mount_point | ( | std::string const & | script | ) |
Create a mount point that checks SCRIPT_NAME, and passes PATH_INFO for dispatching
cppcms::mount_point::mount_point | ( | std::string const & | script, |
std::string const & | path, | ||
int | group | ||
) |
Create a mount point that checks SCRIPT_NAME, PATH_INFO only and passes matched PATH_INFO's group for dispatching
cppcms::mount_point::mount_point | ( | selection_type | sel, |
std::string const & | selected_part, | ||
int | group | ||
) |
Create a mount point with selection rule sel.
sel | selection rule use SCRIPT_INFO or PATH_NAME for URL based dispatching |
selected_part | is a regular expression for matching against PATH_INFO or SCRIPT_NAME according sel |
group | regular expression subgroup of selected_part for URL dispatching |
cppcms::mount_point::mount_point | ( | selection_type | sel, |
std::string const & | non_selected_part | ||
) |
Create a mount point with selection rule sel.
sel | – selection rule use SCRIPT_INFO or PATH_NAME for URL based dispatching |
non_selected_part | is a regular expression for matching against PATH_INFO or SCRIPT_NAME according to opposite of sel, if sel is match_path_info then non_selected_part checked against SCRIPT_NAME otherwise it is checked against PATH_INFO |
cppcms::mount_point::mount_point | ( | selection_type | sel, |
std::string const & | non_selected_part, | ||
std::string const & | selected_part, | ||
int | group | ||
) |
Create a mount point with selection rule sel.
sel | – selection rule use SCRIPT_INFO or PATH_NAME for URL based dispatching |
non_selected_part | is a regular expression for matching against PATH_INFO or SCRIPT_NAME according to opposite of sel, if sel is match_path_info then non_selected_part checked against SCRIPT_NAME otherwise it is checked against PATH_INFO |
selected_part | is a regular expression for matching against PATH_INFO or SCRIPT_NAME according sel |
group | regular expression subgroup of selected_part for URL dispatching |
cppcms::mount_point::mount_point | ( | selection_type | sel, |
booster::regex const & | http_host, | ||
booster::regex const & | script, | ||
booster::regex const & | path, | ||
int | group | ||
) |
Create fully defined mount rule for matching against, http_host - HTTP_HOST, script - SCRIPT_NAME, path - PATH_INFO, and use subgroup group of regular expression selected with sel definition.
Note: if regular expression is empty, no checks are performed.
int cppcms::mount_point::group | ( | ) | const |
Get regular expression subgroup that is passes to application for URL dispatching
void cppcms::mount_point::group | ( | int | ) |
Set regular expression subgroup that is passes to application for URL dispatching
booster::regex cppcms::mount_point::host | ( | ) | const |
Get regular expression for HTTP_HOST CGI variable matching, if empty, no restrictions given
void cppcms::mount_point::host | ( | booster::regex const & | ) |
Set regular expression for HTTP_HOST CGI variable matching, if empty, no restrictions given
std::pair<bool,std::string> cppcms::mount_point::match | ( | std::string const & | h, |
std::string const & | s, | ||
std::string const & | p | ||
) | const |
Match h - HTTP_HOST, s - SCRIPT_NAME, p - PATH_INFO against mount point and return true and selected URL path for application Otherwise return false and empty string
std::pair<bool,std::string> cppcms::mount_point::match | ( | char const * | h, |
char const * | s, | ||
char const * | p | ||
) | const |
Match h - HTTP_HOST, s - SCRIPT_NAME, p - PATH_INFO against mount point and return true and selected URL path for application Otherwise return false and empty string
mount_point const& cppcms::mount_point::operator= | ( | mount_point const & | ) |
Assignment variable
booster::regex cppcms::mount_point::path_info | ( | ) | const |
Get regular expression for PATH_INFO CGI variable matching, if empty, no restrictions given
void cppcms::mount_point::path_info | ( | booster::regex const & | ) |
Set regular expression for PATH_INFO CGI variable matching, if empty, no restrictions given
booster::regex cppcms::mount_point::script_name | ( | ) | const |
Get regular expression for SCRIPT_NAME CGI variable matching, if empty, no restrictions given
void cppcms::mount_point::script_name | ( | booster::regex const & | ) |
Set regular expression for SCRIPT_NAME CGI variable matching, if empty, no restrictions given
selection_type cppcms::mount_point::selection | ( | ) | const |
Get SCRIPT_NAME/PATH_INFO selection
void cppcms::mount_point::selection | ( | selection_type | ) |
Get SCRIPT_NAME/PATH_INFO selection