DataSnap REST Application Wizard
Go Up to DataSnap Server Application
Go Up to File Menu
File > New > Other > Object Pascal Projects > DataSnap Server > DataSnap REST Application
File > New > Other > C++ Projects > DataSnap Server > DataSnap REST Application
The DataSnap REST Application wizard creates a project that is a starting point for building an AJAX-enabled web application. Regardless of the options you select, the wizard creates a unit that contains the following components:
- Note: The TDSRESTWebDispatcher component of the REST application still uses sessions unless you set the SessionLifetime property from TimeOut to Request.
- A WebFileDispatcher component
- A ServerFunctionInvoker component
- A ReverseString component
- A DSProxyGenerator component
- A DSServerMetaDataProvider component
All the additional components are connected to the TDSServer, whose Server property is set to the name of the TDSServer component. The communication protocol between server and client applications is HTTP or HTTPS and the technology is REST (Representational State Transfer).
The DataSnap REST Application Wizard consists of four to seven steps, depending on the type of REST Application you select in the first step and further decisions you take within this wizard. The steps of the wizard are pictured in the following images, followed by a detailed description.
WebBroker Project Type page
In the first step of the wizard, you are prompted to select the type of the REST Application. The possible options are listed in the following table:
Stand-alone FireMonkey application
A stand-alone REST FireMonkey application is a web server that displays a FireMonkey form. It supports HTTP by using an Indy HTTP server component.
Stand-alone console application
A stand-alone REST console application is a web server that has a text-only user interface. It supports HTTP by using an Indy HTTP server component.
ISAPI dynamic link library
ISAPI and NSAPI Web server applications are shared objects that are loaded by the web server. Client request information is passed to the DLL as a structure and evaluated by TISAPIApplication. Each request message is handled in a separate execution thread. When you select this type of application, the library header of the project files and the required entries are added to the uses list. Also, the clause of the project file is exported. ISAPI libraries integrate with IIS. IIS has support for HTTP and HTTPS.
Apache dynamic link module
The Apache Web server hosts static or dynamic websites, providing secure and efficient web server features as CGI (Common Gateway Interface), SSL (Secure Sockets Layer), and virtual domains. Apache has support for HTTP and HTTPS.
Application Type page
This step only occurs when you select Stand-alone application in Step 1. Here you can choose the type of application you want to create.
The available application types are:
- FireMonkey application
Apache Module Options page
This page is displayed only if you select Apache dynamic link module as the type of your project in the first step of this wizard.
Here you are prompted for information as:
- Apache version
- Apache module
- Apache unit
Port Number page
This step of the DataSnap REST Application Wizard is available only if you choose Stand-alone FireMonkey application or Stand-alone console application in the first step of the wizard. In this second step, you are prompted to enter the HTTP communication port. The wizard also allows you to test the availability of the port by using the Test Port button. To automatically complete the HTTP Port field with one of the auto-detected available ports, click the Find Open Port button.
Note: To use the HTTPS protocol, you must select the HTTPS check box. If HTTPS is selected, then the Wizard will have an additional step that prompts for the certificate files. The HTTPS communications port will be set to 443, which is a commonly used port by IIS.
X.509 Certificates page
This step appears only if you select the HTTPS communication protocol in the previous step. Here you are requested to enter the following information to make use of the HTTPS communications protocol:
- File name that holds the X.509 certificate (*.pem)
- File name that holds the key
- File name that contains the password for the key file
- File name that holds the root certificate
To validate the selection, press the Test button.
Server Features page
In this step, you are asked for the DataSnap REST server features.
- If you select the Authentication option, a TDSAuthenticationManager component is placed on the server form. The TDSRESTWebDispatcher component uses TDSAuthenticationManager as the AuthenticationManager to allow the implementation of REST user authentication for the DataSnap server. The implementation consists in implementing the Authenticate property. When Authentication is selected, the client must provide the DataSnap user name and password.
- Select the Server Methods Class option to add a TDSServerClass component to the server form and to allow defining a class on the server that will expose the server methods to the client applications.
- If you select the Sample Methods option, ServerMethodsUnit will contain the implementation of two simple methods called EchoString and ReverseString, which return the Value given as a parameter in normal respective reversed states.
- Selecting the Sample Web Files option results in adding a set of sample web files and related pages to this project. They all can be seen in the Project Manager under this DataSnap server project. Inspect the files inside the templates directory to observe the actual Web implementation for the ServerFunctionInvoker and ReverseString methods.
Server methods ancestor class page
This step of DataSnap REST Application Wizard asks for the ancestor type for the server method class.
Choose TDataModule if you want to use nonvisual components in your server class. Choose TComponent if you want to entirely implement the server class.
Project location page
The last step of the wizard asks for the location of the generated DataSnap REST server. Type in the root directory of the web application you are about to create. This directory is the output directory of the project executable and the location of web application files such as
.css files, and other static files.
- Tutorial: DataSnap Application Using an ISAPI DLL Server
- Creating multi-tiered applications Index
- DataSnap Server Wizard