RAD Studio
ContentsIndex
PreviousUpNext
Receiving Adapter Requests and Generating Responses

When the adapter dispatcher receives a client request, the adapter dispatcher creates adapter request and adapter response objects to hold information about that HTTP request. The adapter request and adapter response objects are stored in the Web context to allow access during the processing of the request. 

The adapter dispatcher creates two types of adapter request objects: action and image. It creates the action request object when executing an adapter action. It creates the image request object when retrieving an image from an adapter field. 

The adapter response object is used by the adapter component to indicate the response to an adapter action or adapter image request. There are two types of adapter response objects, action and image.

Action request objects are responsible for breaking the HTTP request down into information needed to execute an adapter action. The types of information needed for executing an adapter action may include the following request information:  

Request information found in action requests  

Request informaton 
Description 
Component name  
Identifies the adapter action component.  
Adapter mode  
Defines a mode. For example, TDataSetAdapter supports Edit, Insert, and Browse modes. An adapter action may execute differently depending on the mode.  
Success page  
Identifies the page displayed after successful execution of the action.  
Failure page  
Identifies the page displayed if an error occurs during execution of the action.  
Action request parameters  
Identifies the parameters need by the adapter action. For example, the TDataSetAdapter Apply action will include the key values identifying the record to be updated.  
Adapter field values  
Specifies values for the adapter fields passed in the HTTP request when an HTML form is submitted. A field value can include new values entered by the end user, the original values of the adapter field, and uploaded files.  
Record keys  
Specifies keys that uniquely identify each record.  

Action response objects generate an HTTP response on behalf of an adapter action component. The adapter action indicates the type of response by setting properties within the object, or by calling methods in the action response object. The properties include:

  • RedirectOptions—The redirect options indicate whether to perform an HTTP redirect instead of returning HTML content.
  • ExecutionStatus—Setting the status to success causes the default action response to be the content of the success page identified in the Action Request.
The action response methods include:
  • RespondWithPage—The adapter action calls this method when a particular Web page module should generate the response.
  • RespondWithComponent—The adapter action calls this method when the response should come from the Web page module containing this component.
  • RespondWithURL—The adapter action calls this method when the response is a redirect to a specified URL.
When responding with a page, the action response object attempts to use the page dispatcher to generate page content. If it does not find the page dispatcher, it calls the Web page module directly. 

The following figure illustrates how action request and action response objects handle a request. 

 

The image request object is responsible for breaking the HTTP request down into the information required by the adapter image field to generate an image. The types of information represented by the Image Request include:

  • Component name - Identifies the adapter field component.
  • Image request parameters - Identifies the parameters needed by the adapter image. For example, the TDataSetAdapterImageField object needs key values to identify the record that contains the image.

The image response object contains the TWebResponse object. Adapter fields respond to an adapter request by writing an image to the Web response object. 

The following figure illustrates how adapter image fields respond to a request. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!