CppCMS
Public Types | Public Member Functions
cppcms::mount_point Class Reference

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>

List of all members.

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 ()
 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)

Detailed Description

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


Member Enumeration Documentation

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.


Constructor & Destructor Documentation

Create default mount point, it uses PATH_INFO for url-dispatching and gives no restriction on URL

Destructor

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.

Parameters:
selselection rule use SCRIPT_INFO or PATH_NAME for URL based dispatching
selected_partis a regular expression for matching against PATH_INFO or SCRIPT_NAME according sel
groupregular 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.

Parameters:
sel-- selection rule use SCRIPT_INFO or PATH_NAME for URL based dispatching
non_selected_partis 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.

Parameters:
sel-- selection rule use SCRIPT_INFO or PATH_NAME for URL based dispatching
non_selected_partis 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_partis a regular expression for matching against PATH_INFO or SCRIPT_NAME according sel
groupregular 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.


Member Function Documentation

Get regular expression subgroup that is passes to application for URL dispatching

Set regular expression subgroup that is passes to application for URL dispatching

Get regular expression for HTTP_HOST CGI variable matching, if empty, no restrictions given

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

Get regular expression for PATH_INFO CGI variable matching, if empty, no restrictions given

Set regular expression for PATH_INFO CGI variable matching, if empty, no restrictions given

Get regular expression for SCRIPT_NAME CGI variable matching, if empty, no restrictions given

Set regular expression for SCRIPT_NAME CGI variable matching, if empty, no restrictions given

Get SCRIPT_NAME/PATH_INFO selection

Get SCRIPT_NAME/PATH_INFO selection


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