RAD Studio
ContentsIndex
PreviousUpNext
Generating the content of response messages
Name 
Description 
 
The replacement text from an OnHTMLTag event handler need not be the final HTML sequence you want to use in the HTTP response message. You may want to use several page producers, where the output from one page producer is the input for the next.
The simplest way is to chain the page producers together is to associate each page producer with a separate action item, where all action items have the same PathInfo and MethodType. The first action item sets the content of the Web response message from its content producer, but its OnAction event handler makes sure... more 
The page producer converts the HTML template when you call one of its Content methods. When the Content method encounters an HTML-transparent tag, it triggers the OnHTMLTag event. You must write an event handler to determine the type of tag encountered, and to replace it with customized content. See Using page producers from an action item for a simple example of converting HTML-transparent tags.
If you do not create an OnHTMLTag event handler for the page producer, HTML-transparent tags are replaced with an empty string. 
Web Broker provides a number of objects to assist your action items in producing content for HTTP response messages. You can use these objects to generate strings of HTML commands that are saved in a file or sent directly back to the Web client. You can write your own content producers, deriving them from TCustomContentProducer or one of its descendants.
TCustomContentProducer provides a generic interface for creating any MIME type as the content of an HTTP response message. Its descendants include page producers and table producers:
  • Page producers scan HTML documents for special tags that they replace with customized HTML... more 
An HTML template is a sequence of HTML commands and HTML-transparent tags. An HTML-transparent tag has the form  
Page producers provide you with many choices in how to specify the HTML template. You can set the HTMLFile property to the name of a file that contains the HTML template. You can set the HTMLDoc property to a TStrings object that contains the HTML template. If you use either the HTMLFile property or the HTMLDoc property to specify the template, you can generate the converted HTML commands by calling the Content method.
In addition, you can call the ContentFromString method to directly convert an HTML template that is a single string which is passed in as a parameter. You... more 
Page producers (TPageProducer and its descendants) take an HTML template and convert it by replacing special HTML-transparent tags with customized HTML code. You can store a set of standard response templates that are filled in by page producers when you need to generate the response to an HTTP request message. You can chain page producers together to iteratively build up an HTML document by successive refinement of the HTML-transparent tags. 
A typical use of a page producer component uses the HTMLFile property to specify a file containing an HTML template. The OnAction event handler calls the Content method to convert the template into a final HTML sequence:  
While you can create your own HTML-transparent tags to represent any kind of information processed by your page producer, there are several predefined tag names associated with values of the TTag data type. These predefined tag names correspond to HTML commands that are likely to vary over response messages. They are listed in the following table:  
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!