TContentBase

TContentBase

TContentBase is the base class for all content handlers in a IntraWeb application. Content handlers work like TURLMappers in previous IntraWeb versions, i.e., a TContentBase descendant is registered for a URL path. When a request matches the registered path, the IntraWeb server passes the request to the registered TContentBase instance, which in turn processes the response.

Unit

IW.Content.Base

Class hierarchy

TObject -> TContentBase

Methods

Create

[Public]

Declaration: constructor Create; virtual;

Description: Constructs an instance of the class TContentBase and initializes its data.


Execute

[Protected]

Declaration: function Execute(aRequest: THttpRequest; aReply: THttpReply; const aPathname: string; aSession: TIWApplication; aParams: TStrings): boolean;

Description: This method is called by IntraWeb server when the application passes the request to the content handler. Descendant classes must override this method in order to respond to the request.

Parameters:

  • aRequest (THttpRequest): The request object received
  • aReply (THttpReply): The THttpReply object used to respond
  • aPathname (string): The URL path of the request
  • aSession (TIWApplication): The TIWApplication instance
  • aParams (TStrings): The request parameters object

Result: Should return TRUE if the request was successfully handled


Properties

Path: string;

[Public, Read only]

The path registered for the content handler. The value of this property matches the path parameter used when registering the content handler with the THandlers class.

FileMustExist: Boolean;

[Public, Read/Write]

Must be TRUE if a filename matching the request path must exist. If the content handler creates dynamic content, this must be set to FALSE.

RequireSession: Boolean;

[Public, Read/Write]

Must be TRUE if the handler cannot initiate a new session, meaning that a valid session must exist before handling the request.

Events

OnBeforeExecute: TBeforeExecuteHandlerProc;

[Public, Read/Write]

Triggered before the Execute method is called.