Show: Delphi C++
Display Preferences

RAD Server Enhanced URL Mapping

From RAD Studio
Jump to: navigation, search

Go Up to Enterprise Mobility Services (EMS)

New EndPoint Attributes for Content-Type and Accept based mapping

To support better resource mapping, which doesn’t depend only on the URL but also on Accept and Content-Type HTTP request headers. This means you can have two distinct methods mapped to the same URL and HTTP verb, but still returning different types of data depending on the request.

  • EndpointProduce: specifies the MIME types / file extensions that can be produced by this endpoint as response to a GET method. The endpoint selection will be based on the Accept HTTP request header.
  • EndpointConsume: specifies the MIME types / file extensions that can be consumed by this endpoint for PUT, POST, PATCH methods. The endpoint selection will be based on Content-Type HTTP request header.

HTTP Verb to Custom Method Name Mapping

In past versions of RAD Server, the system would generate custom mappings for HTTP verbs (GET, POST, etc) to method names. This remains the default, but you can also map an HTTP verb to a method with a custom name, using the new EndpointMethod attribute. Below is an example of mapping the GET verb to the PrintEmps method of the class:

 TTestResource = class(TDataModule)
   procedure PrintEmps(const AContext: TEndpointContext; 
     const ARequest: TEndpointRequest;
     const AResponse: TEndpointResponse);

See Also

Personal tools
In other languages
Previous Versions