Class TRALServer

Unit

Declaration

type TRALServer = class(TRALComponent)

Description

Base class for HTTP Server components

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function CountSubModules: IntegerRAL;
Public function CreateRequest: TRALRequest;
Public function CreateResponse: TRALResponse;
Public function CreateRoute(const ARoute: StringRAL; AReplyProc: TRALOnReplyGen; const ADescription: StringRAL = ''): TRALRoute; overload;
Public function CreateRoute(const ARoute: StringRAL; AReplyProc: TRALOnReply; const ADescription: StringRAL = ''): TRALRoute; overload;
Public function SSLEnabled: boolean;
Protected function CreateRALSSL: TRALSSL; virtual;
Protected function GetDefaultSSL: TRALSSL;
Protected function GetSubModule(AIndex: IntegerRAL): TRALModuleRoutes;
Protected function IPv6IsImplemented: boolean; virtual;
Protected function ValidateAuth(ARequest: TRALRequest; var AResponse: TRALResponse): boolean;
Public procedure ProcessCommands(ARequest: TRALRequest; AResponse: TRALResponse);
Public procedure Start;
Public procedure Stop;
Public procedure ValidateRequest(ARequest: TRALRequest; AResponse: TRALResponse);
Protected procedure AddSubRoute(ASubRoute: TRALModuleRoutes);
Protected procedure CheckCORS(AAllowOptions: boolean; AAllowMethods: StringRAL; ARequest: TRALRequest; AResponse: TRALResponse);
Protected procedure DelSubRoute(ASubRoute: TRALModuleRoutes);
Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Protected procedure SetActive(const AValue: boolean); virtual;
Protected procedure SetAuthentication(const AValue: TRALAuthServer);
Protected procedure SetEngine(const AValue: StringRAL);
Protected procedure SetPort(const AValue: IntegerRAL); virtual;
Protected procedure SetServerStatus(AValue: TStringList);
Protected procedure SetSessionTimeout(const AValue: IntegerRAL); virtual;

Properties

Published property Active: boolean read FActive write SetActive;
Published property Authentication: TRALAuthServer read FAuthentication write SetAuthentication;
Published property CompressType: TRALCompressType read FCompressType write FCompressType;
Published property CookieLife: integer read FCookieLife write FCookieLife;
Published property CORSOptions: TRALCORSOptions read FCORSOptions write FCORSOptions;
Published property CriptoOptions: TRALCriptoOptions read FCriptoOptions write FCriptoOptions;
Published property Engine: StringRAL read FEngine;
Published property IPConfig: TRALIPConfig read FIPConfig write FIPConfig;
Published property OnClientBlock: TRALOnClientBlock read FOnClientBlock write FOnClientBlock;
Published property OnRequest: TRALOnReply read FOnRequest write FOnRequest;
Published property OnResponse: TRALOnReply read FOnResponse write FOnResponse;
Published property OnServerError: TRALOnServerError read FOnServerError write FOnServerError;
Published property Port: IntegerRAL read FPort write SetPort;
Published property RaiseError: boolean read FRaiseError write FRaiseError default false;
Published property ResponsePages: TRALResponsePages read FResponsePages write FResponsePages;
Published property Routes: TRALRoutes read FRoutes write FRoutes;
Published property Security: TRALSecurity read FSecurity write FSecurity;
Published property ServerStatus: TStringList read FServerStatus write SetServerStatus;
Published property SessionTimeout: IntegerRAL read FSessionTimeout write SetSessionTimeout default 30000;
Published property ShowServerStatus: boolean read FShowServerStatus write FShowServerStatus;
Public property SubModule[AIndex:IntegerRAL]: TRALModuleRoutes read GetSubModule;

Description

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public function CountSubModules: IntegerRAL;
 
Public function CreateRequest: TRALRequest;

Create handle request of server

Public function CreateResponse: TRALResponse;

Create handle response of server

Public function CreateRoute(const ARoute: StringRAL; AReplyProc: TRALOnReplyGen; const ADescription: StringRAL = ''): TRALRoute; overload;
 
Public function CreateRoute(const ARoute: StringRAL; AReplyProc: TRALOnReply; const ADescription: StringRAL = ''): TRALRoute; overload;

Shortcut to create routes on the server

Public function SSLEnabled: boolean;
 
Protected function CreateRALSSL: TRALSSL; virtual;

Used by inherited members to set SSL settings

Protected function GetDefaultSSL: TRALSSL;

Used by inherited members to return the SSL definitions

Protected function GetSubModule(AIndex: IntegerRAL): TRALModuleRoutes;
 
Protected function IPv6IsImplemented: boolean; virtual;

Checks if the current server component allows IPv6

Protected function ValidateAuth(ARequest: TRALRequest; var AResponse: TRALResponse): boolean;

Function that will call Validate from the current authentication component

Public procedure ProcessCommands(ARequest: TRALRequest; AResponse: TRALResponse);

Core procedure of the server, every request will pass through here to be processed into response that will be answered to the client

Public procedure Start;

Shortcut to start the server

Public procedure Stop;

Shortcut to stop the server

Public procedure ValidateRequest(ARequest: TRALRequest; AResponse: TRALResponse);

Validate requests headers before ProcessCommands

Protected procedure AddSubRoute(ASubRoute: TRALModuleRoutes);

Adds a fixed subroute from other components into server routes

Protected procedure CheckCORS(AAllowOptions: boolean; AAllowMethods: StringRAL; ARequest: TRALRequest; AResponse: TRALResponse);

Processes CORS headers

Protected procedure DelSubRoute(ASubRoute: TRALModuleRoutes);

Removes a fixed subroute used by other components

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;

Internal function to properly dispose the component attached to the server

Protected procedure SetActive(const AValue: boolean); virtual;
 
Protected procedure SetAuthentication(const AValue: TRALAuthServer);
 
Protected procedure SetEngine(const AValue: StringRAL);
 
Protected procedure SetPort(const AValue: IntegerRAL); virtual;
 
Protected procedure SetServerStatus(AValue: TStringList);
 
Protected procedure SetSessionTimeout(const AValue: IntegerRAL); virtual;
 

Properties

Published property Active: boolean read FActive write SetActive;
 
Published property Authentication: TRALAuthServer read FAuthentication write SetAuthentication;
 
Published property CompressType: TRALCompressType read FCompressType write FCompressType;

Compression algorithm that will be used on responses to the client

Published property CookieLife: integer read FCookieLife write FCookieLife;

Determinates in seconds how long will the cookies be kept

Published property CORSOptions: TRALCORSOptions read FCORSOptions write FCORSOptions;

Determinates CORS configurations for server-server communication

Published property CriptoOptions: TRALCriptoOptions read FCriptoOptions write FCriptoOptions;

Options for P2P crypt security

Published property Engine: StringRAL read FEngine;

Read-only property to indicate engine version

Published property IPConfig: TRALIPConfig read FIPConfig write FIPConfig;

Configuration params for IP listening

Published property OnClientBlock: TRALOnClientBlock read FOnClientBlock write FOnClientBlock;

Event fired whenever an incoming IP gets blocked by the server

Published property OnRequest: TRALOnReply read FOnRequest write FOnRequest;

Event fired whenever any request is received by the server

Published property OnResponse: TRALOnReply read FOnResponse write FOnResponse;

Event fired whenever any response is sent by the server

Published property OnServerError: TRALOnServerError read FOnServerError write FOnServerError;

Event fired whenever any error happens inside the server

Published property Port: IntegerRAL read FPort write SetPort;

Port to listen to

Published property RaiseError: boolean read FRaiseError write FRaiseError default false;

Whether the server will raise error to the application or not (exception raiseˆ), default value is false

Published property ResponsePages: TRALResponsePages read FResponsePages write FResponsePages;
 
Published property Routes: TRALRoutes read FRoutes write FRoutes;

Route configuration of the server, a.k.a endpoints

Published property Security: TRALSecurity read FSecurity write FSecurity;

Security configurations of the server

Published property ServerStatus: TStringList read FServerStatus write SetServerStatus;

Default text answered by the server without WebModule when requesting the route '/'

Published property SessionTimeout: IntegerRAL read FSessionTimeout write SetSessionTimeout default 30000;

Timeout (miliseconds) for WebModule to determinate max age of the session

Published property ShowServerStatus: boolean read FShowServerStatus write FShowServerStatus;

Boolean check to whether or not show the default text for route '/'

Public property SubModule[AIndex:IntegerRAL]: TRALModuleRoutes read GetSubModule;

Returns a submodule based on the provided AIndex



GitHub Repository
Generated by PasDoc 0.16.0.