Services

A service is an instance of a class implementing the IService interface. Each kind of service processes a specific type of user requests. For example, the page service responds to users' requests for PRADO pages.

A service is uniquely identified by its ID property. By default when THttpRequest is used as the request module, GET variable names are used to identify which service a user is requesting. If a GET variable name is equal to some service ID, the request is considered for that service, and the value of the GET variable is passed as the service parameter. For page service, the name of the GET variable must be page. For example, the following URL requests for the Fundamentals.Services page,

http://hostname/index.php?page=Fundamentals.Services

Developers may implement additional services for their applications. To make a service available, configure it in application configurations.

Page Service

PRADO implements TPageService to process users' page requests. Pages are stored under a directory specified by the BasePath property of the page service. The property defaults to Pages directory under the application base path. You may change this default by configuring the service in the application configuration.

Pages may be organized into subdirectories under the BasePath. In each directory, there may be a page configuration file named config.xml, which contains configurations effective only when a page under that directory or a sub-directory is requested. For more details, see the page configuration section.

Service parameter for the page service refers to the page being requested. A parameter like Fundamentals.Services refers to the Services page under the <BasePath>/Fundamentals directory. If such a parameter is absent in a request, a default page named Home is assumed. Using THttpRequest as the request module (default), the following URLs will request for Home, About and Register pages, respectively,

http://hostname/index.php
http://hostname/index.php?page=About
http://hostname/index.php?page=Users.Register
where the first example takes advantage of the fact that the page service is the default service and Home is the default page.

More advanced url routes, like masking real page names and permitting the use of dynamic parameters can be created using the Url mapping module.