| 3907 | |
| 3908 | |
| 3909 | void ProcessBase::route( |
| 3910 | const string& name, |
| 3911 | const Option<string>& help_, |
| 3912 | const HttpRequestHandler& handler, |
| 3913 | const RouteOptions& options) |
| 3914 | { |
| 3915 | // Routes must start with '/'. |
| 3916 | CHECK(name.find('/') == 0); |
| 3917 | |
| 3918 | // To avoid ambiguity between "/path" and "/path/" we disallow the latter. |
| 3919 | CHECK(name.size() == 1 || name.back() != '/') |
| 3920 | << "Routes must not end with '/'" << ": " << name; |
| 3921 | |
| 3922 | HttpEndpoint endpoint; |
| 3923 | endpoint.handler = handler; |
| 3924 | endpoint.options = options; |
| 3925 | |
| 3926 | handlers.http[name.substr(1)] = endpoint; |
| 3927 | |
| 3928 | dispatch(help, &Help::add, pid.id, name, help_); |
| 3929 | } |
| 3930 | |
| 3931 | |
| 3932 | void ProcessBase::route( |