Class TBrookURLRoute

Unit

Declaration

type TBrookURLRoute = class(TBrookHandledCollectionItem)

Description

Class to represent a URL route item.

Hierarchy

Overview

Fields

Public nested const DefaultReqMethods = [rmGET, rmPOST];

Methods

Public constructor Create(ACollection: TCollection); override;
Public destructor Destroy; override;
Public procedure Validate; inline;

Properties

Public property PCRE2Handle: Pointer read GetPCRE2Handle;
Public property Segments: TArray<string> read GetSegments;
Public property Variables: TBrookStringMap read GetVariables;
Public property RawPattern: string read GetRawPattern;
Public property Path: string read GetPath;
Public property UserData: Pointer read GetUserData;
Published property Default: Boolean read FDefault write SetDefault stored IsDefaultStored default False;
Published property Pattern: string read GetPattern write SetPattern;
Published property Methods: TBrookHTTPRequestMethods read FMethods write FMethods stored IsMethodsStored default DefaultReqMethods;
Published property OnMath: TBrookURLRouteMatchEvent read FOnMath write FOnMath;
Published property OnRequestMethod: TBrookURLRouteRequestMethodEvent read FOnRequestMethod write FOnRequestMethod;
Published property OnRequest: TBrookURLRouteRequestEvent read FOnRequest write FOnRequest;

Description

Fields

Public nested const DefaultReqMethods = [rmGET, rmPOST];

Default route HTTP methods.

Methods

Public constructor Create(ACollection: TCollection); override;

Creates an instance of TBrookURLRoute.

Parameters
ACollection[in]
Routes list.
Public destructor Destroy; override;

Frees an instance of TBrookURLRoute.

Public procedure Validate; inline;

Checks if the route pattern is valid.

Properties

Public property PCRE2Handle: Pointer read GetPCRE2Handle;

Contains the PCRE2 instance.

Public property Segments: TArray<string> read GetSegments;

Contains all path segments (a.k.a. path levels).

Public property Variables: TBrookStringMap read GetVariables;

Contains all path variables (a.k.a. query-string parameters).

Public property RawPattern: string read GetRawPattern;

Contains the raw route pattern. For example, given a pattern /foo, the raw pattern is ˆ/foo$.

Public property Path: string read GetPath;

Contains the route path.

Public property UserData: Pointer read GetUserData;

User-defined data to be stored temporarily in the route object.

Published property Default: Boolean read FDefault write SetDefault stored IsDefaultStored default False;

Default route called if URL does not match any registered route.

Published property Pattern: string read GetPattern write SetPattern;

Pattern to find the route. It must be a valid regular expression in PCRE2 syntax.

Published property Methods: TBrookHTTPRequestMethods read FMethods write FMethods stored IsMethodsStored default DefaultReqMethods;

Allowed methods to find the route.

Published property OnMath: TBrookURLRouteMatchEvent read FOnMath write FOnMath;

Event triggered when the path matches the route pattern.

Published property OnRequestMethod: TBrookURLRouteRequestMethodEvent read FOnRequestMethod write FOnRequestMethod;

Event triggered when the HTTP method matches a route allowed method.

Published property OnRequest: TBrookURLRouteRequestEvent read FOnRequest write FOnRequest;

Event triggered when a client requests the route.


Generated by PasDoc 0.16.0.