TROExtendedHttpDispatcher

Overview

This is the base abstract class for building custom HTTP dispatchers. These dispatchers work together with HTTP server channels and allow to handle non-RPC requests. Using custom HTTP dispatchers Remoting SDK servers can server web pages, JavaScript code, process OData requests.
This class is used internally as a base class for such components as TROHTTPFileDispatcher class and can be used by users who want to expand the Remoting SDK servers functionality.

Location


 

constructor Create  override

Standard component constructor

constructor Create(AOwner: TComponent)

Parameters:

  • AOwner: Owner

Activate  virtual

procedure Activate

Assign  override    (declared in TROComponent)

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

CanHandlePath

Return true if the given path can be handled by the dispatcher. The function compares the Path property content with the given path and chacks if the given path starts with the Path subpath.

function CanHandlePath(aPath: string): Boolean

Parameters:

  • aPath: The request path to check.

Deactivate  virtual

procedure Deactivate

Notification  protected override    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure Notification(aComponent: TComponent; Operation: TOperation)

Parameters:

  • aComponent: component
  • Operation: operation

NotifyDispose

This procedure is called when the server HTTP channel is about to be freed.

procedure NotifyDispose

Path

The request path the dispatcher will be activated for. For example, if this property contains /js then the dispatcher will be activated by the server channel to process such requests as http://example.org:8099/js/* (the asterisk means zero or more characters to continue the request path).

property Path: string read write

Process  virtual abstract

The main method to perform the request processing ant to form the response. Called every time to process incoming requests if the dispatcher is suitable to process it (determined by CanHandlePath result).

procedure Process(aTransport: IROHTTPTransport; aRequest: IROHTTPRequest; aResponse: IROHTTPResponse; aRequestData: TStream; aResponseData: TStream)

Parameters:

  • aTransport: Http transport.
  • aRequest: Contains object implementing IROHTTPRequest interface that describes the request.
  • aResponse: Contains initialized object implementing IROHTTPResponse interface that should describe the response.
  • aRequestData: The data stream (TStream) that contains the raw HTTP request data except the header part.
  • aResponseData: Contais initialized and empty data stream (TStream) that shpuld be filled with the raw reponse data except the header part.

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

Server

Points to the HTTP server channel which the dispatcher works with.

property Server: IROHTTPServer read write

 

Path

The request path the dispatcher will be activated for. For example, if this property contains /js then the dispatcher will be activated by the server channel to process such requests as http://example.org:8099/js/* (the asterisk means zero or more characters to continue the request path).

property Path: string read write

Server

Points to the HTTP server channel which the dispatcher works with.

property Server: IROHTTPServer read write

 

constructor Create  override

Standard component constructor

constructor Create(AOwner: TComponent)

Parameters:

  • AOwner: Owner

Activate  virtual

procedure Activate

Assign  override    (declared in TROComponent)

Copies the contents of another, similar object.

procedure Assign(Source: TPersistent)

Parameters:

  • Source: Instance whose properties will be copied

CanHandlePath

Return true if the given path can be handled by the dispatcher. The function compares the Path property content with the given path and chacks if the given path starts with the Path subpath.

function CanHandlePath(aPath: string): Boolean

Parameters:

  • aPath: The request path to check.

Deactivate  virtual

procedure Deactivate

Notification  protected override    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure Notification(aComponent: TComponent; Operation: TOperation)

Parameters:

  • aComponent: component
  • Operation: operation

NotifyDispose

This procedure is called when the server HTTP channel is about to be freed.

procedure NotifyDispose

Process  virtual abstract

The main method to perform the request processing ant to form the response. Called every time to process incoming requests if the dispatcher is suitable to process it (determined by CanHandlePath result).

procedure Process(aTransport: IROHTTPTransport; aRequest: IROHTTPRequest; aResponse: IROHTTPResponse; aRequestData: TStream; aResponseData: TStream)

Parameters:

  • aTransport: Http transport.
  • aRequest: Contains object implementing IROHTTPRequest interface that describes the request.
  • aResponse: Contains initialized object implementing IROHTTPResponse interface that should describe the response.
  • aRequestData: The data stream (TStream) that contains the raw HTTP request data except the header part.
  • aResponseData: Contais initialized and empty data stream (TStream) that shpuld be filled with the raw reponse data except the header part.

ROFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure ROFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

RORemoveFreeNotification    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure RORemoveFreeNotification(aComponent: TComponent)

Parameters:

  • aComponent: component

SendRemoveNotification  protected    (declared in TROComponent)

Forwards notification messages to all owned components.

procedure SendRemoveNotification(aComponent: TComponent)

Parameters:

  • aComponent: component