Brookframework Ref PDF
Brookframework Ref PDF
Brookframework Ref PDF
Contents
1 Unit BrookAction 1.1 Description . . . . . . . . . . . 1.2 Uses . . . . . . . . . . . . . . . 1.3 Overview . . . . . . . . . . . . 1.4 Classes, Interfaces, Objects and 1.5 Types . . . . . . . . . . . . . . 2 Unit BrookActionHelper 2.1 Description . . . . . . . . . . . 2.2 Uses . . . . . . . . . . . . . . . 2.3 Overview . . . . . . . . . . . . 2.4 Classes, Interfaces, Objects and 3 Unit BrookApplication 3.1 Description . . . . . . . . . . . 3.2 Uses . . . . . . . . . . . . . . . 3.3 Overview . . . . . . . . . . . . 3.4 Classes, Interfaces, Objects and 3.5 Functions and Procedures . . . 4 Unit BrookClasses 4.1 Description . . . . . . . . . . . 4.2 Uses . . . . . . . . . . . . . . . 4.3 Overview . . . . . . . . . . . . 4.4 Classes, Interfaces, Objects and 4.5 Types . . . . . . . . . . . . . . 5 Unit BrookCongurator 5.1 Description . . . . . . . . . . . 5.2 Uses . . . . . . . . . . . . . . . 5.3 Overview . . . . . . . . . . . . 5.4 Classes, Interfaces, Objects and 5.5 Types . . . . . . . . . . . . . . 5 5 5 6 6 16 17 17 17 17 18 21 21 21 21 22 22 24 24 24 24 24 25 26 26 26 26 27 29
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
6 Unit BrookConsts 30 6.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6.2 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 6.3 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 7 Unit BrookDataBase 7.1 Description . . . . . . . . . . . 7.2 Uses . . . . . . . . . . . . . . . 7.3 Overview . . . . . . . . . . . . 7.4 Classes, Interfaces, Objects and 7.5 Types . . . . . . . . . . . . . . 8 Unit BrookDBAction 8.1 Description . . . . . . . . . . . 8.2 Uses . . . . . . . . . . . . . . . 8.3 Overview . . . . . . . . . . . . 8.4 Classes, Interfaces, Objects and 8.5 Types . . . . . . . . . . . . . . 9 Unit BrookDBConsts 9.1 Description . . . . 9.2 Uses . . . . . . . . 9.3 Constants . . . . . 9.4 Variables . . . . . 51 51 51 51 52 57 58 58 58 59 59 61 62 62 62 62 64 65 65 65 65 66 66 68 68 68 68 68 70 71 71 71 71 72 79
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
10 Unit BrookDBUtils 10.1 Description . . . . . . . . 10.2 Uses . . . . . . . . . . . . 10.3 Overview . . . . . . . . . 10.4 Functions and Procedures 10.5 Types . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
11 Unit BrookException 11.1 Description . . . . . . . . . . . 11.2 Uses . . . . . . . . . . . . . . . 11.3 Overview . . . . . . . . . . . . 11.4 Classes, Interfaces, Objects and 11.5 Types . . . . . . . . . . . . . . 12 Unit BrookHTTPClient 12.1 Description . . . . . . . . . . . 12.2 Uses . . . . . . . . . . . . . . . 12.3 Overview . . . . . . . . . . . . 12.4 Classes, Interfaces, Objects and 12.5 Types . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
13 Unit BrookHTTPConsts 13.1 Description . . . . . . 13.2 Uses . . . . . . . . . . 13.3 Constants . . . . . . . 13.4 Variables . . . . . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
80 80 80 80 97
14 Unit BrookHTTPUtils 14.1 Description . . . . . . . . 14.2 Uses . . . . . . . . . . . . 14.3 Overview . . . . . . . . . 14.4 Functions and Procedures 14.5 Types . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
98 . 98 . 98 . 99 . 99 . 102 103 103 103 103 104 106 106 106 106 107 109 110 110 113 113 113 114 114 122 123 123 123 123 124 127 127 127 127 128
15 Unit BrookJSONHelper 15.1 Description . . . . . . . . . . . 15.2 Uses . . . . . . . . . . . . . . . 15.3 Overview . . . . . . . . . . . . 15.4 Classes, Interfaces, Objects and 16 Unit BrookMessages 16.1 Description . . . . . . . . . . . 16.2 Uses . . . . . . . . . . . . . . . 16.3 Overview . . . . . . . . . . . . 16.4 Classes, Interfaces, Objects and 16.5 Functions and Procedures . . . 16.6 Types . . . . . . . . . . . . . . 16.7 Variables . . . . . . . . . . . . 17 Unit BrookQuery 17.1 Description . . . . . . . . . . . 17.2 Uses . . . . . . . . . . . . . . . 17.3 Overview . . . . . . . . . . . . 17.4 Classes, Interfaces, Objects and 17.5 Types . . . . . . . . . . . . . . 18 Unit BrookRequestHelper 18.1 Description . . . . . . . . . . . 18.2 Uses . . . . . . . . . . . . . . . 18.3 Overview . . . . . . . . . . . . 18.4 Classes, Interfaces, Objects and 19 Unit BrookResponseHelper 19.1 Description . . . . . . . . . . . 19.2 Uses . . . . . . . . . . . . . . . 19.3 Overview . . . . . . . . . . . . 19.4 Classes, Interfaces, Objects and
. . . . . . . . . . . . . . . Records
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . . . . . . . . . . . . . Records . . . . . . . . . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . . . . . . . . . . . . . Records
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
20 Unit BrookRESTActions 20.1 Description . . . . . . . . . . . 20.2 Uses . . . . . . . . . . . . . . . 20.3 Overview . . . . . . . . . . . . 20.4 Classes, Interfaces, Objects and 21 Unit BrookRouter 21.1 Description . . . . . . . . . . . 21.2 Uses . . . . . . . . . . . . . . . 21.3 Overview . . . . . . . . . . . . 21.4 Classes, Interfaces, Objects and 21.5 Types . . . . . . . . . . . . . . 22 Unit BrookSession 22.1 Description . . . . . . . . . . . 22.2 Uses . . . . . . . . . . . . . . . 22.3 Overview . . . . . . . . . . . . 22.4 Classes, Interfaces, Objects and 22.5 Types . . . . . . . . . . . . . . 23 Unit BrookTable 23.1 Description . . . . . . . . . . . 23.2 Uses . . . . . . . . . . . . . . . 23.3 Overview . . . . . . . . . . . . 23.4 Classes, Interfaces, Objects and 23.5 Types . . . . . . . . . . . . . . 24 Unit BrookUtils 24.1 Description . . . . . . . . . . . 24.2 Uses . . . . . . . . . . . . . . . 24.3 Overview . . . . . . . . . . . . 24.4 Classes, Interfaces, Objects and 24.5 Functions and Procedures . . . 24.6 Types . . . . . . . . . . . . . . 24.7 Variables . . . . . . . . . . . .
. . . . . . . . . . . . . . . Records
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
130 130 130 130 131 137 137 137 138 138 143 145 145 145 146 146 148 149 149 149 150 150 158 159 159 159 159 160 161 163 164
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . . . . . . . . . . . . Records . . . . . . . . . . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
. . . . . . .
Chapter 1
Unit BrookAction
1.1 Description
Brook Action unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1.2
Uses
BrookClasses(4) BrookException(11) BrookMessages(16) BrookUtils(24) BrookHTTPUtils(14) BrookConsts(6) BrookHTTPConsts(13) HTTPDefs FPJSON Classes SysUtils Variants 5
1.3
Overview
EBrookAction Class Handles exceptions for TBrookAction(1.4). TBrookAction Class Provides features to handle with HTTP requests and responses.
1.4
Description
Handles exceptions for TBrookAction(1.4).
Description
Provides features to handle with HTTP requests and responses.
Properties
Files public property Files: TUploadedFiles read GetFiles; The list of les coming from a request called by the POST method. Fields public property Fields: TJSONObject read FFields;
The list of variables coming from a request called by the POST method. Params public property Params: TJSONObject read FParams;
The list of variables coming from a request called by the GET method. Values public property Values: TJSONObject read FValues;
The list of variables received from parametrized URLs. Method public property Method: string read GetMethod;
Methods
Create Declaration public constructor Create; virtual; Description Creates an instance of a TBrookAction(1.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookAction(1.4) class. FillFields Declaration public procedure FillFields(ARequest: TRequest); virtual;
Description Fills the Fields(1.4) with data coming from a request called by means of POST method. FillParams Declaration public procedure FillParams(ARequest: TRequest); virtual;
Description Fills the Params(1.4) with data coming from a request called by means of GET method. FillValues Declaration public procedure FillValues(ANames, AValues: TBrookArrayOfString); virtual;
Description Fills the Values(1.4) with variables passed through the URL. Register Declaration public class procedure Register(const APattern: Boolean = False); overload; Description Registers an action. Parameters APattern Is an expression dening which URLs is used to call an action. It is possible to use variables inside URLs: :name Represents a variable that spans single URL component between slashes. Examples: TMyAction.Register(/foo/:myvar); Value of a variable "myvar" can be read from the property Values(1.4), e.g.: Write(Values[myvar].AsString); Any number of variables can be combined: TMyAction.Register(/foo/:cat/:id); string; const ADefault:
*name Represents a variable that spans one or more levels between slashes in the curren Examples: TMyAction.Register(/home/*path); Any of the following URLs will match: http://localhost/cgi-bin/cgi1/home/le http://localhost/cgi-bin/cgi1/home/dir/le http://localhost/cgi-bin/cgi1/home/dir/subdir/le etc. Variable Values[path] will receive file, dir/file or dir/subdir/file correspondingly. You can also add static text after variable part: TMyAction.Register(/home/*path/download); http://localhost/cgi-bin/cgi1/home/dir/le/download This will match, http://localhost/cgi-bin/cgi1/home/dir/le/info but not this, because ending is dierent. Multi-level variable can be combined with any number of single-level variables in any order: TMyAction.Register(/home/user/:uid/file/*fpath/version/:vid/info); NOTE: Only one multi-level variable can be specied per URL. url/ Adds a slash to the end of the URL if does not exist. Example: TMyAction.Register(/foo/); An action can be accessed as http://localhost/cgi-bin/cgi1/foo or http://localhost/cgibin/cgi1/foo/. When called as http://localhost/cgi-bin/cgi1/foo, it will be automatically redirected to http://localhost/cgi-bin/cgi1/foo/. If the pathinfo is dierent from /foo a 404 page is returned; NOTE: Two actions cant be registered with the same pattern except when they are called by means of dierent HTTP methods. ADefault A action registered as Default will be called automatically if the URL does not match with Pattern of any registered actions. It is not allowed to register more than one action as default. A typical example of use is: TMyAction.Register(*, True); Register Declaration public class procedure Register(const APattern: string; const AMethod: TBrookRequestMethod; const ADefault: Boolean = False); overload; Description Registers an action specifying the HTTP request method. Parameters AMethod Informs the HTTP request method being valid the following options: rmAll, rmGet, rmHead, rmOptions, rmPost, rmPut or rmDelete. The only way to register two actions with the same pattern is dierentiating the value of this parameter. If at least one action has this parameter changed, the route mapping is enabled in Mapped(24.4). A typical example of use is:
procedure TMyAction1.Get; begin Write(GET); end; procedure TMyAction1.Put; begin Write(PUT); end; procedure TMyAction2.Post; begin Write(POST); end; initialization TMyAction1.Register(/foo1, rmGet); TMyAction1.Register(/foo1, rmPut); TMyAction2.Register(/foo1, rmPost)
GetPath Declaration public class function GetPath: Description Returns the path of action. Exemple: /cgi-bin/cgi1/myaction. DoRequest Declaration public procedure DoRequest(ARequest: overload; virtual; Description Calls the method Request(1.4). DoRequest Declaration public procedure DoRequest(ARequest: TRequest; AResponse: AHandled: Boolean); overload; virtual; Description Calls the method Request(1.4). UrlFor Declaration public function UrlFor(AActionClass: Description Creates an URL for action. 9 TBrookActionClass): string; overload; TResponse; var TRequest; AResponse: TResponse); string;
UrlFor Declaration public function UrlFor(AActionClass: array of string): string; overload; TBrookActionClass; const AParams:
Description Creates an URL for an action informing an array of parameters. Exemple: procedure TMyAction.Get; begin // When calling with http://localhost/cgi-bin/cgi1/foo/myvalue // the output will be /cgi-bin/cgi1/foo/myvalue Write(UrlFor(TMyAction, [myvalue])); end; initialization TMyAction.Register(/foo/:myvar)
UrlFor Declaration public function UrlFor(AClassName: string): string; overload; string; const AParams: array of
Description Creates an URL for an action passing an array of parameters however informing the class name as string. UrlFor Declaration public function UrlFor(AClassName: string): string; overload;
Description Creates an URL for an action informing the class name as string. UrlFor Declaration public function UrlFor(AActionClass: TJSONData): string; overload; TBrookActionClass; const AParams:
Description Creates an URL for an action passing a JSON data. UrlFor Declaration public function UrlFor(AClassName: string; overload; string; const AParams: TJSONData):
Description Creates an URL for an action passing a JSON data however informing the class name as string.
10
Description Is triggered by a request of any HTTP method. Get Declaration public procedure Get; virtual; Description Is triggered by a GET HTTP request method. Post Declaration public procedure Post; virtual; Description Is triggered by a POST HTTP request method. Put Declaration public procedure Put; virtual; Description Is triggered by a PUT HTTP request method. Delete Declaration public procedure Delete; virtual; Description Is triggered by a DELETE HTTP request method. Head Declaration public procedure Head; virtual; Description Is triggered by a HEAD HTTP request method. Options Declaration public procedure Options; virtual; Description Is triggered by a OPTIONS HTTP request method. Redirect Declaration public procedure Redirect(const AUrl: Description Redirects to an URL. string); overload;
11
Redirect Declaration public procedure Redirect(const AUrl: overload; string; const AStatusCode: Word);
Description Redirects to an URL informing the (302, 307) status code. Redirect Declaration public procedure Redirect(const AUrl: overload; Description Redirects to an URL informing the root URL. Redirect Declaration public procedure Redirect(const AUrl: const AStatusCode: Word); overload; string; const AUseRootUrl: Boolean; string; const AUseRootUrl: Boolean);
Description Redirects to an URL informing the (302, 307) status code and the ScriptName. Error Declaration public procedure Error(const AMsg: Description Raises a message for action exceptions. Error Declaration public procedure Error(const AMsg: overload; string; const AArgs: array of const); string); overload;
Description Raises a formated message for action exceptions. Render Declaration public procedure Render(const AFileName: Description Writes the content of a le. Render Declaration public procedure Render(const AFileName: const); overload; TFileName; const AArgs: array of TFileName); overload;
12
Clear Declaration public procedure Clear; Description Clears all written content with Write(), WriteLn(), Render() etc. Write Declaration public procedure Write(const AString: Description Writes a string. Write Declaration public procedure Write(const ABoolean: Description Writes a boolean. Write Declaration public procedure Write(const ABoolean: string); overload; Description Writes a boolean formating output. Write Declaration public procedure Write(const AInteger: Description Writes an integer. Write Declaration public procedure Write(const AFloat: Description Writes a oat. Write Declaration public procedure Write(const AFloat: TFormatSettings); overload; Description Writes a oat formatting output. Write Declaration public procedure Write(AStream: Description Writes a content of stream. 13 TStream); overload; Double; const AFormatSettings: Double); overload; Integer); overload; Boolean; const ATrueStr, AFalseStr: Boolean); overload; string); overload;
Write Declaration public procedure Write(const AFmt: overload; Description Writes a formatted string. Write Declaration public procedure Write(const AFmt: string; const AArgs: const AFormatSettings: TFormatSettings); overload; Description Writes a formatted string. Write Declaration public procedure Write(AJSON: TJSONObject); overload; Description Writes the content of a JSONObject. Write Declaration public procedure Write(AJSON: TJSONArray); overload; Description Writes the content of a TJSONArray. Write Declaration public procedure Write(S: TStrings); overload; Description Writes the content of a TStrings. Write Declaration public procedure Write(const AArgs: Description Writes value of any type. Exemple: Write([1, 3.14, False, ABC]). Write Declaration public procedure Write(const AValue: Description Writes a variant. WriteLn Declaration public procedure WriteLn(const AString: string = ES); overload; Variant); overload; array of const); overload; array of const; string; const AArgs: array of const);
Description Writes a boolean adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const ABoolean: AFalseStr: string); overload; Boolean; const ATrueStr,
Description Writes a boolean formating output and adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const AInteger: Integer); overload;
Description Writes an integer adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const AFloat: Double); overload;
Description Writes a oat adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const AFloat: TFormatSettings); overload; Double; const AFormatSettings:
Description Writes a oat formatting output and adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const AFmt: overload; string; const AArgs: array of const);
Description Writes a formatted string adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const AFmt: string; const AArgs: const AFormatSettings: TFormatSettings); overload; Description Writes a formatted string adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(const AArgs: array of const); overload; array of const;
Description Writes value of any type adding the BR HTML tag to the end. 15
Description Writes a variant adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(AJSON: TJSONObject); overload; Description Writes the content of a JSONObject adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(AJSON: TJSONArray); overload; Description Writes the content of a JSONArray adding the BR HTML tag to the end. WriteLn Declaration public procedure WriteLn(S: TStrings); overload; Description Writes the content of a TStrings adding, for each item, the BR HTML tag to the end.
1.5
Types
TBrookActionClass
Declaration TBrookActionClass = class of TBrookAction; Description Is a metaclass for TBrookAction(1.4) class.
16
Chapter 2
Unit BrookActionHelper
2.1 Description
Brook Action Helper unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2.2
Uses
2.3
Overview
17
2.4
Description
Adds features to TBrookAction class.
Methods
Alert Declaration public procedure Alert(const S: string); Description Shows a dialog with a information message. Conrm Declaration public function Confirm(const S: string): Description Shows a dialog with a conrmation message. Prompt Declaration public function Prompt(const S, ADefaultValue: Description Shows a dialog with a question message. SetCookie Declaration public procedure SetCookie(const AName, AValue: string; const AExpires: TDateTime = NullDate; const APath: string = ES; const ADomain: string = ES; const ASecure: Boolean = False; const AHttpOnly: Boolean = False); Description Creates a cookie. GetCookie Declaration public function GetCookie(const AName: Description Get a cookie value. DeleteCookie Declaration public procedure DeleteCookie(const AName: ES; const ADomain: string = ES); Description Deletes a cookie. 18 string; const APath: string = string): string; string): string; Boolean;
Link Declaration public function Link(ACaption: AClass: string = ES): string; Description Creates a link HTML tag. LinkTo Declaration public function LinkTo(const ACaption: string; AActionClass: TBrookActionClass; const AParams: array of string; const AClass: ES): string; string; const AUrl: string = ES; const
string =
Description Creates a link HTML tag for an action passing an array of parameters however informing the class name as string LinkTo Declaration public function LinkTo(const ACaption: string; AActionClass: TBrookActionClass; const AParams: TJSONData; const AClass: string = ES): string; Description Creates an link HTML tag for an action passing a JSON data. LinkTo Declaration public function LinkTo(const ACaption: string; AActionClass: TBrookActionClass; const AClass: string = ES): string; Description Creates an link HTML tag for an action. LinkTo Declaration public function LinkTo(const ACaption, AClassName: string; const AParams: array of string; const AClass: string = ES): string; Description Creates an link HTML tag for an action passing an array of parameters however informing the class name as string LinkTo Declaration public function LinkTo(const ACaption, AClassName: TJSONData; const AClass: string = ES): string; string; const AParams:
Description Creates an link HTML tag for an action passing a JSON data however informing the class name as string.
19
LinkTo Declaration public function LinkTo(const ACaption, AClassName, AClass: string; string):
Description Creates an link HTML tag for an action informing the class name as string. ButtonTo Declaration public function ButtonTo(const ACaption: string; AActionClass: TBrookActionClass; const AParams: array of string; const AValue: ShortString = delete): string; Description Creates a button HTML tag for an action passing an array of parameters. ButtonTo Declaration public function ButtonTo(const ACaption: string; AActionClass: TBrookActionClass; const AParams: TJSONData; const AValue: ShortString = delete): string; Description Creates an button HTML tag for an action passing a JSON data. ButtonTo Declaration public function ButtonTo(const ACaption: string; AActionClass: TBrookActionClass; const AValue: ShortString = delete): string; Description Creates an button HTML tag for an action. ButtonTo Declaration public function ButtonTo(const ACaption, AClassName: string; const AParams: array of string; const AValue: ShortString = delete): string; Description Creates a button HTML tag for an action passing an array of parameters however informing the class name as string ButtonTo Declaration public function ButtonTo(const ACaption, AClassName: string; const AParams: TJSONData; const AValue: ShortString = delete): string; Description Creates an button HTML tag for an action passing a JSON data however informing the class name as string. ButtonTo Declaration public function ButtonTo(const ACaption, AClassName: ShortString = delete): string; string; const AValue:
Description Creates an button HTML tag for an action informing the class name as string.
20
Chapter 3
Unit BrookApplication
3.1 Description
Brook Application unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3.2
Uses
3.3
Overview
EBrookApplication Class Handles exceptions for application. IBrookApplication Interface Interface of the application. BrookApp Returns the application instance. BrookRegisterApp Register the application. BrookUnregisterApp Unregister the application.
21
3.4
Description
Handles exceptions for application.
Description
Interface of the application.
Methods
Instance Declaration public function Instance: TObject;
Description Returns the instance of broker application. Run Declaration public procedure Run; Description Initializes and runs the application. Terminate Declaration public procedure Terminate; Description Terminates the application.
3.5
BrookApp
Declaration function BrookApp: Description Returns the application instance.
22
BrookRegisterApp
Declaration procedure BrookRegisterApp(AApp: Description Register the application. IBrookApplication);
BrookUnregisterApp
Declaration procedure BrookUnregisterApp; Description Unregister the application.
23
Chapter 4
Unit BrookClasses
4.1 Description
Brook Classes unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4.2
Uses
BrookConsts(6)
4.3
Overview
IBrookInterface Interface Is the main interface for Brook. TBrookObject Class Is the main object for Brook. TBrookInterfacedObject Class Is the main interfaced object for Brook.
4.4
24
Description
Is the main interface for Brook.
Description
Is the main object for Brook.
Description
Is the main interfaced object for Brook.
4.5
Types
TBrookClass
Declaration TBrookClass = class of TBrookObject; Description Is the main class for Brook.
25
Chapter 5
Unit BrookCongurator
5.1 Description
Brook Congurator unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5.2
Uses
5.3
Overview
EBrookConfigurator Class Handles exceptions for TBrookConfigurator(5.4). TBrookConfigurator Class Congures objects by means of string or le. 26
5.4
Description
Handles exceptions for TBrookConfigurator(5.4).
Description
Congures objects by means of string or le.
Properties
AutoLoaded public property AutoLoaded: Boolean read FAutoLoaded write FAutoLoaded; Denes if the conguration is read automatically. Conguration public property Configuration: FConfiguration; string read FConfiguration write
Denes the conguration using one of the following formats. Exemple: cfg.Configuration := param1=value1;param2=value2;param3=value2; or: cfg.Configuration := cgi1.cfg; This option requires the following le format: param1=value1 param2=value2 param3=value2 NOTE: If a conguration is passed to BrookSettings.Configuration, the data informed in this property will be disregarded. Target public property Target: TObject read FTarget write FTarget;
Denes the object to be congured. Values public property Values[AName: Devolve o valor de um parmetro. 27 string]: string read GetValues;
Enables the class name checking, i.e., if the class of the conguring object is a TObject1, the following string will be informed as conguration: tobject1.param1=value1;tobject1.param2=value2;tobject1.param3=value3 This feature is useful when more then one object will be congured in one or more congurator objects.
Methods
Create Declaration public constructor Create; Description Creates an instance of a TBrookConfigurator(5.4) class. Create Declaration public constructor Create(const AConfiguration: string); reintroduce;
Description Creates an instance of a TBrookConfigurator(5.4) class passing the conguration in its parameter. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookConfigurator(5.4) class. Load Declaration public function Load: TBrookConfigurator; virtual;
Description Loads the conguration le to the memory. Clear Declaration public procedure Clear; Description Clears the internal conguration. Congure Declaration public procedure Configure; Description Congures the object informed in the Target property.
28
5.5
Types
TBrookConguratorClass
Declaration TBrookConfiguratorClass = class of TBrookConfigurator; Description Is a metaclass for TBrookConfigurator(5.4) class.
29
Chapter 6
Unit BrookConsts
6.1 Description
Brook Consts unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6.2
ES
Constants
NS
Declaration NS = null; Description Null string.
BR
Declaration BR = <br />; Description BR HTML tag.
30
HS
Declaration HS = : ; Description Param separator.
LE
Declaration LE = LineEnding; Description Line ending.
NU
Declaration NU = #0; Description NULL
HT
Declaration HT = #9; Description TAB
LF
Declaration LF = #10; Description LF
CR
Declaration CR = #13; Description CR
CRLF
Declaration CRLF = CR + LF; Description CRLF
NullDate
Declaration NullDate = 0; Description Null date.
31
SP
Declaration SP = #32; Description Space.
DQ
Declaration DQ = #34; Description
PO
Declaration PO = #35; Description #
PT
Declaration PT = #37; Description %
AM
Declaration AM = #38; Description &
AP
Declaration AP = #39; Description
PS
Declaration PS = #40; Description (
PE
Declaration PE = #41; Description )
32
AK
Declaration AK = #42; Description *
CS
Declaration CS = #44; Description ,
DT
Declaration DT = #46; Description .
US
Declaration US = #47; Description /
CO
Declaration CO = #58; Description :
SC
Declaration SC = #59; Description ;
LT
Declaration LT = #60; Description <
EQ
Declaration EQ = #61; Description =
33
GT
Declaration GT = #62; Description >
QU
Declaration QU = #63; Description ?
AT
Declaration AT = #64; Description @
DS
Declaration DS = #92; Description \
LS
Declaration LS = #91; Description [
RS
Declaration RS = #93; Description ]
BROOK GUID
Declaration BROOK GUID = {D2BDD8EF-78C0-47CD-95C3-664CDFFDAA9E};
BROOK SESS ID
Declaration BROOK SESS ID = BRKSESSID;
Content Compression, application/vnd.americandynamics.acc, .acc), (ACU Cobol, application/vnd.acucobol, .acu), (ACU Cobol, application/vnd.acucorp, .atc), (Adaptive differential pulse-code modulation, audio/adpcm, .adp), (Adobe (Macropedia) Authorware - Binary File, application/x-authorware-bin, .aab), (Adobe (Macropedia) Authorware - Map, application/x-authorware-map, .aam), (Adobe (Macropedia) Authorware - Segment File, application/x-authorware-seg, .aas), (Adobe AIR Application, application/vnd.adobe.air-application-installer-package+zip, .air), (Adobe Flash, application/x-shockwave-flash, .swf), (Adobe Flex Project, application/vnd.adobe.fxp, .fxp), (Adobe Portable Document Format, application/pdf, .pdf), (Adobe PostScript Printer Description File Format, application/vnd.cups-ppd, .ppd), (Adobe Shockwave Player, application/x-director, .dir), (Adobe XML Data Package, application/vnd.adobe.xdp+xml, .xdp), (Adobe XML Forms Data Format, application/vnd.adobe.xfdf, .xfdf), (Advanced Audio Coding (AAC), audio/x-aac, .aac), (Ahead AIR Application, application/vnd.ahead.space, .ahead), (AirZip FileSECURE, application/vnd.airzip.filesecure.azf, .azf), (AirZip FileSECURE, application/vnd.airzip.filesecure.azs, .azs), (Amazon Kindle eBook format, application/vnd.amazon.ebook, .azw), (AmigaDE, application/vnd.amiga.ami, .ami), (Andrew Toolkit, application/andrew-inset, N/A), (Android Package Archive, application/vnd.android.package-archive, .apk), (ANSER-WEB Terminal Client - Certificate Issue, application/vnd.anser-web-certificate-issue-initiation, .cii), (ANSER-WEB Terminal Client - Web Funds Transfer, application/vnd.anser-web-funds-transfer-initiation, .fti), (Antix Game Player, application/vnd.antix.game-component, .atx), (Apple Installer Package, application/vnd.apple.installer+xml, .mpkg), (Applixware, application/applixware, .aw), (Archipelago Lesson Player, application/vnd.hhe.lesson-player, .les), (Arista Networks Software Image, application/vnd.aristanetworks.swi, .swi), (Assembler Source File, text/x-asm, .s), (Atom Publishing Protocol, application/atomcat+xml, .atomcat), (Atom Publishing Protocol Service Document, application/atomsvc+xml, .atomsvc), (Atom Syndication Format, application/atom+xml, .atom, .xml), (Attribute Certificate, application/pkix-attr-cert, .ac), (Audio Interchange File Format, audio/x-aiff, .aif), (Audio Video Interleave (AVI), video/x-msvideo, .avi), (Audiograph, application/vnd.audiograph, .aep), (AutoCAD DXF, image/vnd.dxf, .dxf), (Autodesk Design Web Format (DWF), model/vnd.dwf, .dwf), (Binary CPIO Archive, application/x-bcpio, .bcpio), (Binary Data, application/octet-stream, .bin), (Bitmap Image File, image/bmp, .bmp), (BitTorrent, application/x-bittorrent, .torrent), (Blackberry COD File, application/vnd.rim.cod, .cod), (Blueice Research Multipass, application/vnd.blueice.multipass, .mpm), 36
(BMI Drawing Data Interchange, application/vnd.bmi, .bmi), (Bourne Shell Script, application/x-sh, .sh), (BTIF, image/prs.btif, .btif), (BusinessObjects, application/vnd.businessobjects, .rep), (Bzip Archive, application/x-bzip, .bz), (Bzip2 Archive, application/x-bzip2, .bz2), (C Shell Script, application/x-csh, .csh), (C Source File, text/x-c, .c), (CambridgeSoft Chem Draw, application/vnd.chemdraw+xml, .cdxml), (Cascading Style Sheets (CSS), text/css, .css), (ChemDraw eXchange file, chemical/x-cdx, .cdx), (Chemical Markup Language, chemical/x-cml, .cml), (Chemical Style Markup Language, chemical/x-csml, .csml), (CIM Database, application/vnd.contact.cmsg, .cdbcmsg), (Claymore Data Files, application/vnd.claymore, .cla), (Clonk Game, application/vnd.clonk.c4group, .c4g), (Close Captioning - Subtitle, image/vnd.dvb.subtitle, .sub), (Cloud Data Management Interface (CDMI) Capability, application/cdmi-capability, .cdmia), (Cloud Data Management Interface (CDMI) - Contaimer, application/cdmi-container, .cdmic), (Cloud Data Management Interface (CDMI) - Domain, application/cdmi-domain, .cdmid), (Cloud Data Management Interface (CDMI) - Object, application/cdmi-object, .cdmio), (Cloud Data Management Interface (CDMI) - Queue, application/cdmi-queue, .cdmiq), (ClueTrust CartoMobile - Config, application/vnd.cluetrust.cartomobile-config, .c11amc), (ClueTrust CartoMobile - Config Package, application/vnd.cluetrust.cartomobile-config-pkg, .c11amz), (CMU Image, image/x-cmu-raster, .ras), (COLLADA, model/vnd.collada+xml, .dae), (Comma-Seperated Values, text/csv, .csv), (Compact Pro, application/mac-compactpro, .cpt), (Compiled Wireless Markup Language (WMLC), application/vnd.wap.wmlc, .wmlc), (Computer Graphics Metafile, image/cgm, .cgm), (CoolTalk, x-conference/x-cooltalk, .ice), (Corel Metafile Exchange (CMX), image/x-cmx, .cmx), (CorelXARA, application/vnd.xara, .xar), (CosmoCaller, application/vnd.cosmocaller, .cmc), (CPIO Archive, application/x-cpio, .cpio), (CrickSoftware - Clicker, application/vnd.crick.clicker, .clkx), (CrickSoftware - Clicker Keyboard, application/vnd.crick.clicker.keyboard, .clkk), (CrickSoftware - Clicker - Palette, application/vnd.crick.clicker.palette, .clkp), (CrickSoftware - Clicker - Template, application/vnd.crick.clicker.template, .clkt), (CrickSoftware - Clicker - Wordbank, application/vnd.crick.clicker.wordbank, .clkw), (Critical Tools - PERT Chart EXPERT, application/vnd.criticaltools.wbs+xml, .wbs), (CryptoNote, application/vnd.rig.cryptonote, .cryptonote), (Crystallographic Interchange Format, chemical/x-cif, .cif), (CrystalMaker Data Format, chemical/x-cmdf, .cmdf), (CU-SeeMe, application/cu-seeme, .cu), (CU-Writer, application/prs.cww, .cww), (Curl - Applet, text/vnd.curl, .curl), (Curl - Detached Applet, 37
text/vnd.curl.dcurl, .dcurl), (Curl - Manifest File, text/vnd.curl.mcurl, .mcurl), (Curl - Source Code, text/vnd.curl.scurl, .scurl), (CURL Applet, application/vnd.curl.car, .car), (CURL Applet, application/vnd.curl.pcurl, .pcurl), (CustomMenu, application/vnd.yellowriver-custom-menu, .cmp), (Data Structure for the Security Suitability of Cryptographic Algorithms, application/dssc+der, .dssc), (Data Structure for the Security Suitability of Cryptographic Algorithms, application/dssc+xml, .xdssc), (Debian Package, application/x-debian-package, .deb), (DECE Audio, audio/vnd.dece.audio, .uva), (DECE Graphic, image/vnd.dece.graphic, .uvi), (DECE High Definition Video, video/vnd.dece.hd, .uvh), (DECE Mobile Video, video/vnd.dece.mobile, .uvm), (DECE MP4, video/vnd.uvvu.mp4, .uvu), (DECE PD Video, video/vnd.dece.pd, .uvp), (DECE SD Video, video/vnd.dece.sd, .uvs), (DECE Video, video/vnd.dece.video, .uvv), (Device Independent File Format (DVI), application/x-dvi, .dvi), (Digital Siesmograph Networks - SEED Datafiles, application/vnd.fdsn.seed, .seed), (Digital Talking Book, application/x-dtbook+xml, .dtb), (Digital Talking Book - Resource File, application/x-dtbresource+xml, .res), (Digital Video Broadcasting, application/vnd.dvb.ait, .ait), (Digital Video Broadcasting, application/vnd.dvb.service, .svc), (Digital Winds Music, audio/vnd.digital-winds, .eol), (DjVu, image/vnd.djvu, .djvu), (Document Type Definition, application/xml-dtd, .dtd), (Dolby Meridian Lossless Packing, application/vnd.dolby.mlp, .mlp), (Doom Video Game, application/x-doom, .wad), (DPGraph, application/vnd.dpgraph, .dpg), (DRA Audio, audio/vnd.dra, .dra), (DreamFactory, application/vnd.dreamfactory, .dfac), (DTS Audio, audio/vnd.dts, .dts), (DTS High Definition Audio, audio/vnd.dts.hd, .dtshd), (DWG Drawing, image/vnd.dwg, .dwg), (DynaGeo, application/vnd.dynageo, .geo), (ECMAScript, application/ecmascript, .es), (EcoWin Chart, application/vnd.ecowin.chart, .mag), (EDMICS 2000, image/vnd.fujixerox.edmics-mmr, .mmr), (EDMICS 2000, image/vnd.fujixerox.edmics-rlc, .rlc), (Efficient XML Interchange, application/exi, .exi), (EFI Proteus, application/vnd.proteus.magazine, .mgz), (Electronic Publication, application/epub+zip, .epub), (Email Message, message/rfc822, .eml), (Enliven Viewer, application/vnd.enliven, .nml), (Express by Infoseek, application/vnd.is-xpr, .xpr), (eXtended Image File Format (XIFF), image/vnd.xiff, .xif), (Extensible Forms Description Language, application/vnd.xfdl, .xfdl), (Extensible MultiModal Annotation, application/emma+xml, .emma), (EZPix Secure Photo Album, application/vnd.ezpix-album, .ez2), (EZPix Secure Photo Album, application/vnd.ezpix-package, .ez3), (FAST Search & Transfer ASA, image/vnd.fst, .fst), (FAST Search & Transfer ASA, video/vnd.fvt, .fvt), (FastBid Sheet, image/vnd.fastbidsheet, .fbs), (FCS Express Layout Link, application/vnd.denovo.fcselayout-link, .fe launch), 38
(Flash Video, video/x-f4v, .f4v), (Flash Video, video/x-flv, .flv), (FlashPix, image/vnd.fpx, .fpx), (FlashPix, image/vnd.net-fpx, .npx), (FLEXSTOR, text/vnd.fmi.flexstor, .flx), (FLI/FLC Animation Format, video/x-fli, .fli), (FluxTime Clip, application/vnd.fluxtime.clip, .ftc), (Forms Data Format, application/vnd.fdf, .fdf), (Fortran Source File, text/x-fortran, .f), (FrameMaker Interchange Format, application/vnd.mif, .mif), (FrameMaker Normal Format, application/vnd.framemaker, .fm), (FreeHand MX, image/x-freehand, .fh), (Friendly Software Corporation, application/vnd.fsc.weblaunch, .fsc), (Frogans Player, application/vnd.frogans.fnc, .fnc), (Frogans Player, application/vnd.frogans.ltf, .ltf), (Fujitsu - Xerox 2D CAD Data, application/vnd.fujixerox.ddd, .ddd), (Fujitsu - Xerox DocuWorks, application/vnd.fujixerox.docuworks, .xdw), (Fujitsu - Xerox DocuWorks Binder, application/vnd.fujixerox.docuworks.binder, .xbd), (Fujitsu Oasys, application/vnd.fujitsu.oasys, .oas), (Fujitsu Oasys, application/vnd.fujitsu.oasys2, .oa2), (Fujitsu Oasys, application/vnd.fujitsu.oasys3, .oa3), (Fujitsu Oasys, application/vnd.fujitsu.oasysgp, .fg5), (Fujitsu Oasys, application/vnd.fujitsu.oasysprs, .bh2), (FutureSplash Animator, application/x-futuresplash, .spl), (FuzzySheet, application/vnd.fuzzysheet, .fzs), (G3 Fax Image, image/g3fax, .g3), (GameMaker ActiveX, application/vnd.gmx, .gmx), (Gen-Trix Studio, model/vnd.gtw, .gtw), (Genomatix Tuxedo Framework, application/vnd.genomatix.tuxedo, .txd), (GeoGebra, application/vnd.geogebra.file, .ggb), (GeoGebra, application/vnd.geogebra.tool, .ggt), (Geometric Description Language (GDL), model/vnd.gdl, .gdl), (GeoMetry Explorer, application/vnd.geometry-explorer, .gex), (GEONExT and JSXGraph, application/vnd.geonext, .gxt), (GeoplanW, application/vnd.geoplan, .g2w), (GeospacW, application/vnd.geospace, .g3w), (Ghostscript Font, application/x-font-ghostscript, .gsf), (Glyph Bitmap Distribution Format, application/x-font-bdf, .bdf), (GNU Tar Files, application/x-gtar, .gtar), (GNU Texinfo Document, application/x-texinfo, .texinfo), (Gnumeric, application/x-gnumeric, .gnumeric), (Google Earth - KML, application/vnd.google-earth.kml+xml, .kml), (Google Earth - Zipped KML, application/vnd.google-earth.kmz, .kmz), (GrafEq, application/vnd.grafeq, .gqf), (Graphics Interchange Format, image/gif, .gif), (Graphviz, text/vnd.graphviz, .gv), (Groove - Account, application/vnd.groove-account, .gac), (Groove Help, application/vnd.groove-help, .ghf), (Groove - Identity Message, application/vnd.groove-identity-message, .gim), (Groove - Injector, application/vnd.groove-injector, .grv), (Groove - Tool Message, application/vnd.groove-tool-message, .gtm), (Groove - Tool Template, application/vnd.groove-tool-template, .tpl), (Groove - Vcard, application/vnd.groove-vcard, .vcg), (H.261, video/h261, .h261), 39
(H.263, video/h263, .h263), (H.264, video/h264, .h264), (Hewlett Packard Instant Delivery, application/vnd.hp-hpid, .hpid), (Hewlett-Packards WebPrintSmart, application/vnd.hp-hps, .hps), (Hierarchical Data Format, application/x-hdf, .hdf), (HitnMix, audio/vnd.rip, .rip), (Homebanking Computer Interface (HBCI), application/vnd.hbci, .hbci), (HP Indigo Digital Press - Job Layout Languate, application/vnd.hp-jlyt, .jlt), (HP Printer Command Language, application/vnd.hp-pcl, .pcl), (HP-GL/2 and HP RTL, application/vnd.hp-hpgl, .hpgl), (HV Script, application/vnd.yamaha.hv-script, .hvs), (HV Voice Dictionary, application/vnd.yamaha.hv-dic, .hvd), (HV Voice Parameter, application/vnd.yamaha.hv-voice, .hvp), (Hydrostatix Master Suite, application/vnd.hydrostatix.sof-data, .sfd-hdstx), (Hyperstudio, application/hyperstudio, .stk), (Hypertext Application Language, application/vnd.hal+xml, .hal), (HyperText Markup Language (HTML), text/html, .html), (IBM DB2 Rights Manager, application/vnd.ibm.rights-management, .irm), (IBM Electronic Media Management System - Secure Container, application/vnd.ibm.secure-container, .sc), (iCalendar, text/calendar, .ics), (ICC profile, application/vnd.iccprofile, .icc), (Icon Image, image/x-icon, .ico), (igLoader, application/vnd.igloader, .igl), (Image Exchange Format, image/ief, .ief), (ImmerVision PURE Players, application/vnd.immervision-ivp, .ivp), (ImmerVision PURE Players, application/vnd.immervision-ivu, .ivu), (IMS Networks, application/reginfo+xml, .rif), (In3D - 3DML, text/vnd.in3d.3dml, .3dml), (In3D - 3DML, text/vnd.in3d.spot, .spot), (Initial Graphics Exchange Specification (IGES), model/iges, .igs), (Interactive Geometry Software, application/vnd.intergeo, .i2g), (Interactive Geometry Software Cinderella, application/vnd.cinderella, .cdy), (Intercon FormNet, application/vnd.intercon.formnet, .xpw), (International Society for Advancement of Cytometry, application/vnd.isac.fcs, .fcs), (Internet Protocol Flow Information Export, application/ipfix, .ipfix), (Internet Public Key Infrastructure - Certificate, application/pkix-cert, .cer), (Internet Public Key Infrastructure - Certificate Management Protocole, application/pkixcmp, .pki), (Internet Public Key Infrastructure Certificate Revocation Lists, application/pkix-crl, .crl), (Internet Public Key Infrastructure - Certification Path, application/pkix-pkipath, .pkipath), (IOCOM Visimeet, application/vnd.insors.igm, .igm), (IP Unplugged Roaming Client, application/vnd.ipunplugged.rcprofile, .rcprofile), (iRepository / Lucidoc Editor, application/vnd.irepository.package+xml, .irp), (J2ME App Descriptor, text/vnd.sun.j2me.app-descriptor, .jad), (Java Archive, application/java-archive, .jar), (Java Bytecode File, application/java-vm, .class), (Java Network Launching Protocol, application/x-java-jnlp-file, .jnlp), (Java Serialized Object, 40
application/java-serialized-object, .ser), (Java Source File, text/x-java-source,java, .java), (JavaScript, application/javascript, .js), (JavaScript Object Notation (JSON), application/json, .json), (Joda Archive, application/vnd.joost.joda-archive, .joda), (JPEG 2000 Compound Image File Format, video/jpm, .jpm), (JPEG Image, image/jpeg, .jpeg, .jpg), (JPGVideo, video/jpeg, .jpgv), (Kahootz, application/vnd.kahootz, .ktz), (Karaoke on Chipnuts Chipsets, application/vnd.chipnuts.karaoke-mmd, .mmd), (KDE KOffice Office Suite - Karbon, application/vnd.kde.karbon, .karbon), (KDE KOffice Office Suite - KChart, application/vnd.kde.kchart, .chrt), (KDE KOffice Office Suite - Kformula, application/vnd.kde.kformula, .kfo), (KDE KOffice Office Suite - Kivio, application/vnd.kde.kivio, .flw), (KDE KOffice Office Suite - Kontour, application/vnd.kde.kontour, .kon), (KDE KOffice Office Suite - Kpresenter, application/vnd.kde.kpresenter, .kpr), (KDE KOffice Office Suite Kspread, application/vnd.kde.kspread, .ksp), (KDE KOffice Office Suite - Kword, application/vnd.kde.kword, .kwd), (Kenamea App, application/vnd.kenameaapp, .htke), (Kidspiration, application/vnd.kidspiration, .kia), (Kinar Applications, application/vnd.kinar, .kne), (Kodak Storyshare, application/vnd.kodak-descriptor, .sse), (Laser App Enterprise, application/vnd.las.las+xml, .lasxml), (LaTeX, application/x-latex, .latex), (Life Balance - Desktop Edition, application/vnd.llamagraphics.life-balance.desktop, .lbd), (Life Balance - Exchange Format, application/vnd.llamagraphics.life-balance.exchange+xml, .lbe), (Lightspeed Audio Lab, application/vnd.jam, .jam), (Lotus 1-2-3, application/vnd.lotus-1-2-3, .123), (Lotus Approach, application/vnd.lotus-approach, .apr), (Lotus Freelance, application/vnd.lotus-freelance, .pre), (Lotus Notes, application/vnd.lotus-notes, .nsf), (Lotus Organizer, application/vnd.lotus-organizer, .org), (Lotus Screencam, application/vnd.lotus-screencam, .scm), (Lotus Wordpro, application/vnd.lotus-wordpro, .lwp), (Lucent Voice, audio/vnd.lucent.voice, .lvp), (M3U (Multimedia Playlist), audio/x-mpegurl, .m3u), (M4v, video/x-m4v, .m4v), (Macintosh BinHex 4.0, application/mac-binhex40, .hqx), (MacPorts Port System, application/vnd.macports.portpkg, .portpkg), (MapGuide DBXML, application/vnd.osgeo.mapguide.package, .mgp), (MARC Formats, application/marc, .mrc), (MARC21 XML Schema, application/marcxml+xml, .mrcx), (Material Exchange Format, application/mxf, .mxf), (Mathematica Notebook Player, application/vnd.wolfram.player, .nbp), (Mathematica Notebooks, application/mathematica, .ma), (Mathematical Markup Language, application/mathml+xml, .mathml), (Mbox database files, application/mbox, .mbox), (MedCalc, application/vnd.medcalcdata, .mc1), (Media Server Control Markup 41
Language, application/mediaservercontrol+xml, .mscml), (MediaRemote, application/vnd.mediastation.cdkey, .cdkey), (Medical Waveform Encoding Format, application/vnd.mfer, .mwf), (Melody Format for Mobile Platform, application/vnd.mfmp, .mfm), (Mesh Data Type, model/mesh, .msh), (Metadata Authority Description Schema, application/mads+xml, .mads), (Metadata Encoding and Transmission Standard, application/mets+xml, .mets), (Metadata Object Description Schema, application/mods+xml, .mods), (Metalink, application/metalink4+xml, .meta4), (Micosoft PowerPoint - Macro-Enabled Template File, application/vnd.ms-powerpoint.template.macroenabled.12, .potm), (Micosoft Word - Macro-Enabled Document, application/vnd.ms-word.document.macroenabled.12, .docm), (Micosoft Word - Macro-Enabled Template, application/vnd.ms-word.template.macroenabled.12, .dotm), (Micro CADAM Helix D&D, application/vnd.mcd, .mcd), (Micrografx, application/vnd.micrografx.flo, .flo), (Micrografx iGrafx Professional, application/vnd.micrografx.igx, .igx), (MICROSEC e-Szign, application/vnd.eszigno3+xml, .es3), (Microsoft Access, application/x-msaccess, .mdb), (Microsoft Advanced Systems Format (ASF), video/x-ms-asf, .asf), (Microsoft Application, application/x-msdownload, .exe), (Microsoft Artgalry, application/vnd.ms-artgalry, .cil), (Microsoft Cabinet File, application/vnd.ms-cab-compressed, .cab), (Microsoft Class Server, application/vnd.ms-ims, .ims), (Microsoft ClickOnce, application/x-ms-application, .application), (Microsoft Clipboard Clip, application/x-msclip, .clp), (Microsoft Document Imaging Format, image/vnd.ms-modi, .mdi), (Microsoft Embedded OpenType, application/vnd.ms-fontobject, .eot), (Microsoft Excel, application/vnd.ms-excel, .xls), (Microsoft Excel - Add-In File, application/vnd.ms-excel.addin.macroenabled.12, .xlam), (Microsoft Excel - Binary Workbook, application/vnd.ms-excel.sheet.binary.macroenabled.12, .xlsb), (Microsoft Excel - Macro-Enabled Template File, application/vnd.ms-excel.template.macroenabled.12, .xltm), (Microsoft Excel - Macro-Enabled Workbook, application/vnd.ms-excel.sheet.macroenabled.12, .xlsm), (Microsoft Html Help File, application/vnd.ms-htmlhelp, .chm), (Microsoft Information Card, application/x-mscardfile, .crd), (Microsoft Learning Resource Module, application/vnd.ms-lrm, .lrm), (Microsoft MediaView, application/x-msmediaview, .mvb), (Microsoft Money, application/x-msmoney, .mny), (Microsoft Office - OOXML - Presentation, application/vnd.openxmlformats-officedocument.presentationml.presentation, .pptx), (Microsoft Office - OOXML - Presentation (Slide), application/vnd.openxmlformats-officedocument.presentationml.slide, .sldx), (Microsoft Office - OOXML - Presentation (Slideshow), application/vnd.openxmlformats-officedocument.presentationml.slideshow, .ppsx), (Microsoft Office - OOXML - Presentation Template, 42
application/vnd.openxmlformats-officedocument.presentationml.template, .potx), (Microsoft Office - OOXML - Spreadsheet, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, .xlsx), (Microsoft Office - OOXML - Spreadsheet Teplate, application/vnd.openxmlformats-officedocument.spreadsheetml.template, .xltx), (Microsoft Office - OOXML - Word Document, application/vnd.openxmlformats-officedocument.wordprocessingml.document, .docx), (Microsoft Office - OOXML - Word Document Template, application/vnd.openxmlformats-officedocument.wordprocessingml.template, .dotx), (Microsoft Office Binder, application/x-msbinder, .obd), (Microsoft Office System Release Theme, application/vnd.ms-officetheme, .thmx), (Microsoft OneNote, application/onenote, .onetoc), (Microsoft PlayReady Ecosystem, audio/vnd.ms-playready.media.pya, .pya), (Microsoft PlayReady Ecosystem Video, video/vnd.ms-playready.media.pyv, .pyv), (Microsoft PowerPoint, application/vnd.ms-powerpoint, .ppt), (Microsoft PowerPoint - Add-in file, application/vnd.ms-powerpoint.addin.macroenabled.12, .ppam), (Microsoft PowerPoint - Macro-Enabled Open XML Slide, application/vnd.ms-powerpoint.slide.macroenabled.12, .sldm), (Microsoft PowerPoint - Macro-Enabled Presentation File, application/vnd.ms-powerpoint.presentation.macroenabled.12, .pptm), (Microsoft PowerPoint - Macro-Enabled Slide Show File, application/vnd.ms-powerpoint.slideshow.macroenabled.12, .ppsm), (Microsoft Project, application/vnd.ms-project, .mpp), (Microsoft Publisher, application/x-mspublisher, .pub), (Microsoft Schedule+, application/x-msschedule, .scd), (Microsoft Silverlight, application/x-silverlight-app, .xap), (Microsoft Trust UI Provider Certificate Trust Link, application/vnd.ms-pki.stl, .stl), (Microsoft Trust UI Provider - Security Catalog, application/vnd.ms-pki.seccat, .cat), (Microsoft Visio, application/vnd.visio, .vsd), (Microsoft Windows Media, video/x-ms-wm, .wm), (Microsoft Windows Media Audio, audio/x-ms-wma, .wma), (Microsoft Windows Media Audio Redirector, audio/x-ms-wax, .wax), (Microsoft Windows Media Audio/Video Playlist, video/x-ms-wmx, .wmx), (Microsoft Windows Media Player Download Package, application/x-ms-wmd, .wmd), (Microsoft Windows Media Player Playlist, application/vnd.ms-wpl, .wpl), (Microsoft Windows Media Player Skin Package, application/x-ms-wmz, .wmz), (Microsoft Windows Media Video, video/x-ms-wmv, .wmv), (Microsoft Windows Media Video Playlist, video/x-ms-wvx, .wvx), (Microsoft Windows Metafile, application/x-msmetafile, .wmf), (Microsoft Windows Terminal Services, application/x-msterminal, .trm), (Microsoft Word, application/msword, .doc), (Microsoft Wordpad, application/x-mswrite, .wri), (Microsoft Works, application/vnd.ms-works, .wps), (Microsoft XAML Browser Application, application/x-ms-xbap, .xbap), (Microsoft XML Paper Specification, application/vnd.ms-xpsdocument, .xps), (MIDI - Musical Instrument Digital Interface, audio/midi, .mid), (MiniPay, 43
application/vnd.ibm.minipay, .mpy), (MO:DCA-P, application/vnd.ibm.modcap, .afp), (Mobile Information Device Profile, application/vnd.jcp.javame.midlet-rms, .rms), (MobileTV, application/vnd.tmobile-livetv, .tmo), (Mobipocket, application/x-mobipocket-ebook, .prc), (Mobius Management Systems Basket file, application/vnd.mobius.mbk, .mbk), (Mobius Management Systems - Distribution Database, application/vnd.mobius.dis, .dis), (Mobius Management Systems - Policy Definition Language File, application/vnd.mobius.plc, .plc), (Mobius Management Systems - Query File, application/vnd.mobius.mqy, .mqy), (Mobius Management Systems Script Language, application/vnd.mobius.msl, .msl), (Mobius Management Systems - Topic Index File, application/vnd.mobius.txf, .txf), (Mobius Management Systems - UniversalArchive, application/vnd.mobius.daf, .daf), (mod fly / fly.cgi, text/vnd.fly, .fly), (Mophun Certificate, application/vnd.mophun.certificate, .mpc), (Mophun VM, application/vnd.mophun.application, .mpn), (Motion JPEG 2000, video/mj2, .mj2), (MPEG Audio, audio/mpeg, .mpga), (MPEG Url, video/vnd.mpegurl, .mxu), (MPEG Video, video/mpeg, .mpeg), (MPEG-21, application/mp21, .m21), (MPEG-4 Audio, audio/mp4, .mp4a), (MPEG-4 Video, video/mp4, .mp4), (MPEG4, application/mp4, .mp4), (Multimedia Playlist Unicode, application/vnd.apple.mpegurl, .m3u8), (MUsical Score Interpreted Code Invented for the ASCII designation of Notation, application/vnd.musician, .mus), (Muvee Automatic Video Editing, application/vnd.muvee.style, .msty), (MXML, application/xv+xml, .mxml), (N-Gage Game Data, application/vnd.nokia.n-gage.data, .ngdat), (N-Gage Game Installer, application/vnd.nokia.n-gage.symbian.install, .n-gage), (Navigation Control file for XML (for ePub), application/x-dtbncx+xml, .ncx), (Network Common Data Form (NetCDF), application/x-netcdf, .nc), (neuroLanguage, application/vnd.neurolanguage.nlu, .nlu), (New Moon Liftoff/DNA, application/vnd.dna, .dna), (NobleNet Directory, application/vnd.noblenet-directory, .nnd), (NobleNet Sealer, application/vnd.noblenet-sealer, .nns), (NobleNet Web, application/vnd.noblenet-web, .nnw), (Nokia Radio Application - Preset, application/vnd.nokia.radio-preset, .rpst), (Nokia Radio Application Preset, application/vnd.nokia.radio-presets, .rpss), (Notation3, text/n3, .n3), (Novadigms RADIA and EDM products, application/vnd.novadigm.edm, .edm), (Novadigms RADIA and EDM products, application/vnd.novadigm.edx, .edx), (Novadigms RADIA and EDM products, application/vnd.novadigm.ext, .ext), (NpGraphIt, application/vnd.flographit, .gph), (Nuera ECELP 4800, audio/vnd.nuera.ecelp4800, .ecelp4800), (Nuera ECELP 7470, audio/vnd.nuera.ecelp7470, .ecelp7470), (Nuera ECELP 9600, audio/vnd.nuera.ecelp9600, .ecelp9600), (Office Document Architecture, application/oda, .oda), (Ogg, application/ogg, .ogx), (Ogg Audio, audio/ogg, .oga), (Ogg Video, video/ogg, .ogv), (OMA Download 44
Agents, application/vnd.oma.dd2+xml, .dd2), (Open Document Text Web, application/vnd.oasis.opendocument.text-web, .oth), (Open eBook Publication Structure, application/oebps-package+xml, .opf), (Open Financial Exchange, application/vnd.intu.qbo, .qbo), (Open Office Extension, application/vnd.openofficeorg.extension, .oxt), (Open Score Format, application/vnd.yamaha.openscoreformat, .osf), (Open Web Media Project - Audio, audio/webm, .weba), (Open Web Media Project - Video, video/webm, .webm), (OpenDocument Chart, application/vnd.oasis.opendocument.chart, .odc), (OpenDocument Chart Template, application/vnd.oasis.opendocument.chart-template, .otc), (OpenDocument Database, application/vnd.oasis.opendocument.database, .odb), (OpenDocument Formula, application/vnd.oasis.opendocument.formula, .odf), (OpenDocument Formula Template, application/vnd.oasis.opendocument.formula-template, .odft), (OpenDocument Graphics, application/vnd.oasis.opendocument.graphics, .odg), (OpenDocument Graphics Template, application/vnd.oasis.opendocument.graphics-template, .otg), (OpenDocument Image, application/vnd.oasis.opendocument.image, .odi), (OpenDocument Image Template, application/vnd.oasis.opendocument.image-template, .oti), (OpenDocument Presentation, application/vnd.oasis.opendocument.presentation, .odp), (OpenDocument Presentation Template, application/vnd.oasis.opendocument.presentation-template, .otp), (OpenDocument Spreadsheet, application/vnd.oasis.opendocument.spreadsheet, .ods), (OpenDocument Spreadsheet Template, application/vnd.oasis.opendocument.spreadsheet-template, .ots), (OpenDocument Text, application/vnd.oasis.opendocument.text, .odt), (OpenDocument Text Master, application/vnd.oasis.opendocument.text-master, .odm), (OpenDocument Text Template, application/vnd.oasis.opendocument.text-template, .ott), (OpenGL Textures (KTX), image/ktx, .ktx), (OpenOffice - Calc (Spreadsheet), application/vnd.sun.xml.calc, .sxc), (OpenOffice - Calc Template (Spreadsheet), application/vnd.sun.xml.calc.template, .stc), (OpenOffice - Draw (Graphics), application/vnd.sun.xml.draw, .sxd), (OpenOffice - Draw Template (Graphics), application/vnd.sun.xml.draw.template, .std), (OpenOffice - Impress (Presentation), application/vnd.sun.xml.impress, .sxi), (OpenOffice Impress Template (Presentation), application/vnd.sun.xml.impress.template, .sti), (OpenOffice - Math (Formula), application/vnd.sun.xml.math, .sxm), (OpenOffice - Writer (Text - HTML), application/vnd.sun.xml.writer, .sxw), (OpenOffice - Writer (Text HTML), application/vnd.sun.xml.writer.global, .sxg), (OpenOffice Writer Template (Text - HTML), application/vnd.sun.xml.writer.template, .stw), (OpenType Font File, application/x-font-otf, .otf), (OSFPVG, application/vnd.yamaha.openscoreformat.osfpvg+xml, .osfpvg), (OSGi 45
Deployment Package, application/vnd.osgi.dp, .dp), (PalmOS Data, application/vnd.palm, .pdb), (Pascal Source File, text/x-pascal, .p), (PawaaFILE, application/vnd.pawaafile, .paw), (PCL 6 Enhanced (Formely PCL XL), application/vnd.hp-pclxl, .pclxl), (Pcsel eFIF File, application/vnd.picsel, .efif), (PCX Image, image/x-pcx, .pcx), (Photoshop Document, image/vnd.adobe.photoshop, .psd), (PICSRules, application/pics-rules, .prf), (PICT Image, image/x-pict, .pic), (pIRCh, application/x-chat, .chat), (PKCS #10 - Certification Request Standard, application/pkcs10, .p10), (PKCS #12 - Personal Information Exchange Syntax Standard, application/x-pkcs12, .p12), (PKCS #7 Cryptographic Message Syntax Standard, application/pkcs7-mime, .p7m), (PKCS #7 - Cryptographic Message Syntax Standard, application/pkcs7-signature, .p7s), (PKCS #7 - Cryptographic Message Syntax Standard (Certificate Request Response), application/x-pkcs7-certreqresp, .p7r), (PKCS #7 - Cryptographic Message Syntax Standard (Certificates), application/x-pkcs7-certificates, .p7b), (PKCS #8 - Private-Key Information Syntax Standard, application/pkcs8, .p8), (PocketLearn Viewers, application/vnd.pocketlearn, .plf), (Portable Anymap Image, image/x-portable-anymap, .pnm), (Portable Bitmap Format, image/x-portable-bitmap, .pbm), (Portable Compiled Format, application/x-font-pcf, .pcf), (Portable Font Resource, application/font-tdpfr, .pfr), (Portable Game Notation (Chess Games), application/x-chess-pgn, .pgn), (Portable Graymap Format, image/x-portable-graymap, .pgm), (Portable Network Graphics (PNG), image/png, .png), (Portable Pixmap Format, image/x-portable-pixmap, .ppm), (Portable Symmetric Key Container, application/pskc+xml, .pskcxml), (PosML, application/vnd.ctc-posml, .pml), (PostScript, application/postscript, .ai), (PostScript Fonts, application/x-font-type1, .pfa), (PowerBuilder, application/vnd.powerbuilder6, .pbd), (Pretty Good Privacy, application/pgp-encrypted, ), (Pretty Good Privacy - Signature, application/pgp-signature, .pgp), (Preview Systems ZipLock/VBox, application/vnd.previewsystems.box, .box), (Princeton Video Image, application/vnd.pvi.ptid1, .ptid), (Pronunciation Lexicon Specification, application/pls+xml, .pls), (Proprietary P&G Standard Reporting System, application/vnd.pg.format, .str), (Proprietary P&G Standard Reporting System, application/vnd.pg.osasli, .ei6), (PRS Lines Tag, text/prs.lines.tag, .dsc), (PSF Fonts, application/x-font-linux-psf, .psf), (PubliShare Objects, application/vnd.publishare-delta-tree, .qps), (Qualcomms Plaza Mobile Internet, application/vnd.pmi.widget, .wg), (QuarkXpress, application/vnd.quark.quarkxpress, .qxd), (QUASS Stream Player, application/vnd.epson.esf, .esf), (QUASS Stream Player, application/vnd.epson.msf, .msf), (QUASS Stream Player, application/vnd.epson.ssf, .ssf), (QuickAnime Player, application/vnd.epson.quickanime, .qam), (Quicken, 46
application/vnd.intu.qfx, .qfx), (Quicktime Video, video/quicktime, .qt), (RAR Archive, application/x-rar-compressed, .rar), (Real Audio Sound, audio/x-pn-realaudio, .ram), (Real Audio Sound, audio/x-pn-realaudio-plugin, .rmp), (Really Simple Discovery, application/rsd+xml, .rsd), (RealMedia, application/vnd.rn-realmedia, .rm), (RealVNC, application/vnd.realvnc.bed, .bed), (Recordare Applications, application/vnd.recordare.musicxml, .mxl), (Recordare Applications, application/vnd.recordare.musicxml+xml, .musicxml), (Relax NG Compact Syntax, application/relax-ng-compact-syntax, .rnc), (RemoteDocs R-Viewer, application/vnd.data-vision.rdz, .rdz), (Resource Description Framework, application/rdf+xml, .rdf), (RetroPlatform Player, application/vnd.cloanto.rp9, .rp9), (RhymBox, application/vnd.jisp, .jisp), (Rich Text Format, application/rtf, .rtf), (Rich Text Format (RTF), text/richtext, .rtx), (ROUTE 66 Location Based Services, application/vnd.route66.link66+xml, .link66), (RSS - Really Simple Syndication, application/rss+xml, .rss, .xml), (S Hexdump Format, application/shf+xml, .shf), (SailingTracker, application/vnd.sailingtracker.track, .st), (Scalable Vector Graphics (SVG), image/svg+xml, .svg), (ScheduleUs, application/vnd.sus-calendar, .sus), (Search/Retrieve via URL Response Format, application/sru+xml, .sru), (Secure Electronic Transaction Payment, application/set-payment-initiation, .setpay), (Secure Electronic Transaction - Registration, application/set-registration-initiation, .setreg), (Secured eMail, application/vnd.sema, .sema), (Secured eMail, application/vnd.semd, .semd), (Secured eMail, application/vnd.semf, .semf), (SeeMail, application/vnd.seemail, .see), (Server Normal Format, application/x-font-snf, .snf), (Server-Based Certificate Validation Protocol - Validation Policies - Request, application/scvp-vp-request, .spq), (Server-Based Certificate Validation Protocol - Validation Policies - Response, application/scvp-vp-response, .spp), (Server-Based Certificate Validation Protocol - Validation Request, application/scvp-cv-request, .scq), (Server-Based Certificate Validation Protocol - Validation Response, application/scvp-cv-response, .scs), (Session Description Protocol, application/sdp, .sdp), (Setext, text/x-setext, .etx), (SGI Movie, video/x-sgi-movie, .movie), (Shana Informed Filler, application/vnd.shana.informed.formdata, .ifm), (Shana Informed Filler, application/vnd.shana.informed.formtemplate, .itp), (Shana Informed Filler, application/vnd.shana.informed.interchange, .iif), (Shana Informed Filler, application/vnd.shana.informed.package, .ipk), (Sharing Transaction Fraud Data, application/thraud+xml, .tfi), (Shell Archive, application/x-shar, .shar), (Silicon Graphics RGB Bitmap, image/x-rgb, .rgb), (SimpleAnimeLite Player, application/vnd.epson.salt, .slt), (Simply Accounting, application/vnd.accpac.simply.aso, .aso), (Simply Accounting - Data 47
Import, application/vnd.accpac.simply.imp, .imp), (SimTech MindMapper, application/vnd.simtech-mindmapper, .twd), (Sixth Floor Media CommonSpace, application/vnd.commonspace, .csp), (SMAF Audio, application/vnd.yamaha.smaf-audio, .saf), (SMAF File, application/vnd.smaf, .mmf), (SMAF Phrase, application/vnd.yamaha.smaf-phrase, .spf), (SMART Technologies Apps, application/vnd.smart.teacher, .teacher), (SourceView Document, application/vnd.svd, .svd), (SPARQL - Query, application/sparql-query, .rq), (SPARQL - Results, application/sparql-results+xml, .srx), (Speech Recognition Grammar Specification, application/srgs, .gram), (Speech Recognition Grammar Specification - XML, application/srgs+xml, .grxml), (Speech Synthesis Markup Language, application/ssml+xml, .ssml), (SSEYO Koan Play File, application/vnd.koan, .skp), (Standard Generalized Markup Language (SGML), text/sgml, .sgml), (StarOffice - Calc, application/vnd.stardivision.calc, .sdc), (StarOffice - Draw, application/vnd.stardivision.draw, .sda), (StarOffice - Impress, application/vnd.stardivision.impress, .sdd), (StarOffice - Math, application/vnd.stardivision.math, .smf), (StarOffice - Writer, application/vnd.stardivision.writer, .sdw), (StarOffice - Writer (Global), application/vnd.stardivision.writer-global, .sgl), (StepMania, application/vnd.stepmania.stepchart, .sm), (Stuffit Archive, application/x-stuffit, .sit), (Stuffit Archive, application/x-stuffitx, .sitx), (SudokuMagic, application/vnd.solent.sdkm+xml, .sdkm), (Sugar Linux Application Bundle, application/vnd.olpc-sugar, .xo), (Sun Audio - Au file format, audio/basic, .au), (SundaHus WQ, application/vnd.wqd, .wqd), (Symbian Install Package, application/vnd.symbian.install, .sis), (Synchronized Multimedia Integration Language, application/smil+xml, .smi), (SyncML, application/vnd.syncml+xml, .xsm), (SyncML - Device Management, application/vnd.syncml.dm+wbxml, .bdm), (SyncML - Device Management, application/vnd.syncml.dm+xml, .xdm), (System V Release 4 CPIO Archive, application/x-sv4cpio, .sv4cpio), (System V Release 4 CPIO Checksum Data, application/x-sv4crc, .sv4crc), (Systems Biology Markup Language, application/sbml+xml, .sbml), (Tab Seperated Values, text/tab-separated-values, .tsv), (Tagged Image File Format, image/tiff, .tiff), (Tao Intent, application/vnd.tao.intent-module-archive, .tao), (Tar File (Tape Archive), application/x-tar, .tar), (Tcl Script, application/x-tcl, .tcl), (TeX, application/x-tex, .tex), (TeX Font Metric, application/x-tex-tfm, .tfm), (Text Encoding and Interchange, application/tei+xml, .tei), (Text File, text/plain, .txt), (TIBCO Spotfire, application/vnd.spotfire.dxp, .dxp), (TIBCO Spotfire, application/vnd.spotfire.sfs, .sfs), (Time Stamped Data Envelope, application/timestamped-data, .tsd), (TRI Systems Config, application/vnd.trid.tpt, .tpt), (Triscape Map Explorer, 48
application/vnd.triscape.mxs, .mxs), (troff, text/troff, .t), (True BASIC, application/vnd.trueapp, .tra), (TrueType Font, application/x-font-ttf, .ttf), (Turtle (Terse RDF Triple Language), text/turtle, .ttl), (UMAJIN, application/vnd.umajin, .umj), (Unique Object Markup Language, application/vnd.uoml+xml, .uoml), (Unity 3d, application/vnd.unity, .unityweb), (Universal Forms Description Language, application/vnd.ufdl, .ufd), (URI Resolution Services, text/uri-list, .uri), (User Interface Quartz - Theme (Symbian), application/vnd.uiq.theme, .utz), (Ustar (Uniform Standard Tape Archive), application/x-ustar, .ustar), (UUEncode, text/x-uuencode, .uu), (vCalendar, text/x-vcalendar, .vcs), (vCard, text/x-vcard, .vcf), (Video CD, application/x-cdlink, .vcd), (Viewport+, application/vnd.vsf, .vsf), (Virtual Reality Modeling Language, model/vrml, .wrl), (VirtualCatalog, application/vnd.vcx, .vcx), (Virtue MTS, model/vnd.mts, .mts), (Virtue VTU, model/vnd.vtu, .vtu), (Visionary, application/vnd.visionary, .vis), (Vivo, video/vnd.vivo, .viv), (Voice Browser Call Control, application/ccxml+xml,, .ccxml), (VoiceXML, application/voicexml+xml, .vxml), (WAIS Source, application/x-wais-source, .src), (WAP Binary XML (WBXML), application/vnd.wap.wbxml, .wbxml), (WAP Bitamp (WBMP), image/vnd.wap.wbmp, .wbmp), (Waveform Audio File Format (WAV), audio/x-wav, .wav), (Web Distributed Authoring and Versioning, application/davmount+xml, .davmount), (Web Open Font Format, application/x-font-woff, .woff), (Web Services Policy, application/wspolicy+xml, .wspolicy), (WebP Image, image/webp, .webp), (WebTurbo, application/vnd.webturbo, .wtb), (Widget Packaging and XML Configuration, application/widget, .wgt), (WinHelp, application/winhlp, .hlp), (Wireless Markup Language (WML), text/vnd.wap.wml, .wml), (Wireless Markup Language Script (WMLScript), text/vnd.wap.wmlscript, .wmls), (WMLScript, application/vnd.wap.wmlscriptc, .wmlsc), (Wordperfect, application/vnd.wordperfect, .wpd), (Worldtalk, application/vnd.wt.stf, .stf), (WSDL - Web Services Description Language, application/wsdl+xml, .wsdl), (X BitMap, image/x-xbitmap, .xbm), (X PixMap, image/x-xpixmap, .xpm), (X Window Dump, image/x-xwindowdump, .xwd), (X.509 Certificate, application/x-x509-ca-cert, .der), (Xfig, application/x-xfig, .fig), (XHTML - The Extensible HyperText Markup Language, application/xhtml+xml, .xhtml), (XML - Extensible Markup Language, application/xml, .xml), (XML Configuration Access Protocol - XCAP Diff, application/xcap-diff+xml, .xdf), (XML Encryption Syntax and Processing, application/xenc+xml, .xenc), (XML Patch Framework, application/patch-ops-error+xml, .xer), (XML Resource Lists, application/resource-lists+xml, .rl), (XML Resource Lists, application/rls-services+xml, .rs), (XML Resource Lists Diff, 49
application/resource-lists-diff+xml, .rld), (XML Transformations, application/xslt+xml, .xslt), (XML-Binary Optimized Packaging, application/xop+xml, .xop), (XPInstall - Mozilla, application/x-xpinstall, .xpi), (XSPF - XML Shareable Playlist Format, application/xspf+xml, .xspf), (XUL - XML User Interface Language, application/vnd.mozilla.xul+xml, .xul), (XYZ File Format, chemical/x-xyz, .xyz), (YANG Data Modeling Language, application/yang, .yang), (YIN (YANG - XML), application/yin+xml, .yin), (Z.U.L. Geometry, application/vnd.zul, .zir), (Zip Archive, application/zip, .zip), (ZVUE Media Manager, application/vnd.handheld-entertainment+xml, .zmm), (Zzazz Deck, application/vnd.zzazz.deck+xml, .zaz) );
6.3
Variables
50
Chapter 7
Unit BrookDataBase
7.1 Description
Brook DataBase unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7.2
Uses
7.3
Overview
51
EBrookDataBases Class Handles exceptions for TBrookDataBases(7.4). TBrookDataBase Class Oers general abstract features for databases handling. TBrookDataBases Class Registers and congure database classes.
7.4
Description
Handles exceptions for TBrookDataBase(7.4).
Description
Handles exceptions for TBrookDataBases(7.4).
Description
Oers general abstract features for databases handling.
Properties
Connected public property Connected: Boolean read GetConnected; Checks if the database is connected. Driver public property Driver: string read GetDriver write SetDriver;
Denes the driver name. In Zeos driver is know as Protocol; in Unidac, Provider, etc. Database public property Database: string read GetDatabase write SetDatabase;
52
User
Password
Host
Port
Methods
Init Declaration public constructor Init; virtual; Description Creates an instance of a TBrookDataBase(7.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookDataBase(7.4) class. Create Declaration public class function Create: TBrookDataBase;
Description Creates an instance of a TBrookDataBase(7.4) class. Register Declaration public class procedure Register; Description Register the broker class. Unregister Declaration public class procedure Unregister; Description Unregister the broker class.
53
Description Adds objects that will be automatically freed when the database object is destroyed. RemoveObject Declaration public procedure RemoveObject(AObject: TObject);
Description Removes objects that would be automatically freed when the database object is destroyed. GetLibrary Declaration public class function GetLibrary: string; virtual; abstract;
Description Get the broker library name, exemple: SQLdb, Zeos, UniDAC etc. Connect Declaration public procedure Connect; virtual; abstract; Description Connects to the data base. Disconnect Declaration public procedure Disconnect; virtual; abstract; Description Disconnects from the data base. InTransaction Declaration public function InTransaction: Description Checks if a transaction is active. StartTransaction Declaration public procedure StartTransaction; virtual; abstract; Description Starts a transaction. Commit Declaration public procedure Commit; virtual; abstract; Description Commits a transaction. Boolean; virtual; abstract;
54
Rollback Declaration public procedure Rollback; virtual; abstract; Description Rollbacks a transaction.
Description
Registers and congure database classes.
Properties
Current public property Current: The current database item. Items public property Items[const AIndex: GetItems write SetItems; The list of database items. Congurator public property Configurator: A congurator for database items. TBrookConfigurator read FConfigurator; Integer]: TBrookDataBaseClass read TBrookDataBase read FCurrent write FCurrent;
Methods
Create Declaration public constructor Create; Description Creates an instance of a TBrookDataBases(7.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookDataBases(7.4) class. RegisterService Declaration public class procedure RegisterService; Description Registers the service provided by this class.
55
UnregisterService Declaration public class procedure UnregisterService; Description Unregisters the service provided by this class. Service Declaration public class function Service: Description Return a instance of this class. CreateDataBase Declaration public function CreateDataBase: Description Creates an database item. FreeCurrent Declaration public procedure FreeCurrent; Description Frees the current database item. Count Declaration public function Count: Integer; TBrookDataBase; TBrookDataBases;
Description Returns the number of registered databases. Find Declaration public function Find(const ALibrary: Description Finds a database item by its library name. ItemByLibrary Declaration public function ItemByLibrary(const ALibrary: TBrookDataBaseClass; Description Returns a database item by its library name. Add Declaration public procedure Add(AClass: Description Adds a database item. TBrookDataBaseClass); string): string): TBrookDataBaseClass;
56
Remove Declaration public procedure Remove(AClass: Description Removes a database item. TBrookDataBaseClass);
7.5
Types
TBrookDataBaseClass
Declaration TBrookDataBaseClass = class of TBrookDataBase; Description Is a metaclass for TBrookDataBase(7.4) class.
TBrookDataBasesClass
Declaration TBrookDataBasesClass = class of TBrookDataBases; Description Is a metaclass for TBrookDataBases(7.4) class.
57
Chapter 8
Unit BrookDBAction
8.1 Description
Brook DB Action unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8.2
Uses
58
8.3
Overview
EBrookDBAction Class Handles exceptions for TBrookDBAction(8.4). TBrookCustomDBAction Class Custom class for manages HTTP requests and responses when data persistance is required. TBrookDBAction Class Manages HTTP requests and responses when data persistance is required.
8.4
Description
Handles exceptions for TBrookDBAction(8.4).
Description
Custom class for manages HTTP requests and responses when data persistance is required.
Methods
Register Declaration public class procedure Register(const ATableName, APattern: ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. string; const
59
Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. SetTableName Declaration public class procedure SetTableName(const ATableName: Description Denes the table name. GetTableName Declaration public class function GetTableName: Description Returns the table name. SetIgnoredFields Declaration public class procedure SetIgnoredFields(const AFields: Description Dene the elds that will be ignored for persistance purposes. GetIgnoredFields Declaration public class function GetIgnoredFields: string; string); string; string);
Description
Manages HTTP requests and responses when data persistance is required. 60
Properties
DataBase public property DataBase: TBrookDataBase read GetDataBase write SetDataBase; Denes the current database or return it. Table public property Table: TBrookTable read GetTable write SetTable;
Methods
Create Declaration public constructor Create; override; Description Creates an instance of TBrookDBAction. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookDBAction(8.4) class.
8.5
Types
TBrookDBActionClass
Declaration TBrookDBActionClass = class of TBrookDBAction; Description Is a metaclass for TBrookDBAction(8.4) class.
61
Chapter 9
Unit BrookDBConsts
9.1 Description
Brook DB Consts unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9.2
Uses
BrookConsts(6)
9.3
Constants
BROOK FT NULL
Declaration BROOK FT NULL = null;
BROOK FT STRING
Declaration BROOK FT STRING = string;
BROOK FT BOOLEAN
Declaration BROOK FT BOOLEAN = boolean;
BROOK FT DATE
Declaration BROOK FT DATE = date; 62
BROOK FT FLOAT
Declaration BROOK FT FLOAT = float;
BROOK FT INT
Declaration BROOK FT INT = int;
63
9.4
Variables
64
Chapter 10
Unit BrookDBUtils
10.1 Description
Brook DB Utils unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10.2
DB
Uses
BrookConsts(6)
SysUtils StrUtils
10.3
Overview
BrookDataSetToHTMLTable Converts dataset into HTML table. BrookDataSetToHTML5Table Converts dataset into HTML-5 table. BrookFieldDefsToHTMLForm Converts FieldDefs into HTML form.
65
10.4
BrookDataSetToHTMLTable
Declaration function BrookDataSetToHTMLTable( ADataSet: TDataSet; const ATitles: array of string; const AClass: string = ES; const ABorderWidth: Integer = 1; const AUnavailableFields: TBrookUnavailableFields = []; ACallback: TBrookDataSetToHTML5TableCallback = nil): string; Description Converts dataset into HTML table.
BrookDataSetToHTML5Table
Declaration function BrookDataSetToHTML5Table( ADataSet: TDataSet; const ATitles: array of string; const ACaption: string = ES; const AFoot: string = ES; const AClass: string = ES; const ABorderWidth: Integer = 1; const AUnavailableFields: TBrookUnavailableFields = []; ACallback: TBrookDataSetToHTML5TableCallback = nil): string; Description Converts dataset into HTML-5 table.
BrookFieldDefsToHTMLForm
Declaration function BrookFieldDefsToHTMLForm( AFieldDefs: TFieldDefs; const AAction: string = #; const AMethod: string = post; const ALineBreak: Boolean = False; const AClass: string = ES; const ALabelAbove: Boolean = False): string; Description Converts FieldDefs into HTML form.
10.5
Types
TBrookUnavailableFields
Declaration TBrookUnavailableFields = set of TFieldType; Description Set of data types for BrookDataSetToHTMLTable and BrookDataSetToHTML5Table.
TBrookHTMLTableWritingState
Declaration TBrookHTMLTableWritingState = (...); Description Informs the writing stage of the table. Values wtHeadTR wtHeadTD wtBodyTR wtBodyTD
66
TBrookDataSetToHTMLTableCallback
Declaration TBrookDataSetToHTMLTableCallback = function(ADataSet: TDataSet; const AWritingType: TBrookHTMLTableWritingState; const APosition, AMax: Integer; var AData: string): string of object; Description Callback for BrookDataSetToHTMLTable.
TBrookDataSetToHTML5TableCallback
Declaration TBrookDataSetToHTML5TableCallback = TBrookDataSetToHTMLTableCallback; Description Callback for BrookDataSetToHTML5Table.
67
Chapter 11
Unit BrookException
11.1 Description
Brook Exception unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11.2
Uses
BrookConsts(6) SysUtils
11.3
Overview
EBrook Class Handles general exception in Brook. EBrookHTTP404 Class Handles the exception for 404 error. EBrookHTTP500 Class Handles the exception for 500 error.
11.4
Description
Handles general exception in Brook.
Methods
Create Declaration public constructor Create(AInstance: overload; Description Creates an instance of EBrook. Create Declaration public constructor Create(AClass: Description Creates an instance of EBrook. Create Declaration public constructor Create(AName: Description Creates an instance of EBrook. CreateFmt Declaration public constructor CreateFmt(AInstance: AArgs: array of const); overload; TObject; const AMsg: string; const string; const AMsg: string); overload; TClass; const AMsg: string); overload; TObject; const AMsg: string);
Description Creates an instance of EBrook with a formated message. CreateFmt Declaration public constructor CreateFmt(AClass: AArgs: array of const); overload; TClass; const AMsg: string; const
Description Creates an instance of EBrook with a formated message. CreateFmt Declaration public constructor CreateFmt(AName: AArgs: array of const); overload; string; const AMsg: string; const
Description
Handles the exception for 404 error.
Description
Handles the exception for 500 error.
11.5
Types
EBrookClass
Declaration EBrookClass = class of EBrook; Description Is a metaclass for EBrook(11.4) class.
70
Chapter 12
Unit BrookHTTPClient
12.1 Description
Brook HTTP Client unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12.2
Uses
12.3
Overview
71
EBrookHTTPDefs Class Handles exceptions for TBrookHTTPDefs(12.4). EBrookHTTPClient Class Handles exceptions for EBrookHTTPClient(12.4). TBrookHTTPResult record Information returned after a request. TBrookHTTPDef Class Oers general abstract features for HTTP handling. TBrookHTTPDefs Class Registers HTTP denitions. TBrookHTTPClient Class Client to perform HTTP requests.
12.4
Description
Handles exceptions for TBrookHTTPDef(12.4).
Description
Handles exceptions for TBrookHTTPDefs(12.4).
Description
Handles exceptions for EBrookHTTPClient(12.4).
72
Fields
StatusCode StatusCode: Integer; string; ReasonPhrase ReasonPhrase: Header Content Header: Content:
string; string;
Description
Oers general abstract features for HTTP handling.
Properties
ContentType public property ContentType: SetContentType; Content type of sending data. Contents public property Contents: TStrings read GetContents; string read GetContentType write
Strings received from the request. Cookies public property Cookies: TStrings read GetCookies;
Set cookies to be sent and/or received from the server. Document public property Document: TStream read GetDocument;
Document received from the request. Headers public property Headers: Request headers. StatusCode public property StatusCode: Integer read GetStatusCode; TStrings read GetHeaders;
Result code after successful request. ReasonPhrase public property ReasonPhrase: Result text after successful request. Method public property Method: Method for requests. Url public property Url: string read GetUrl write SetUrl; string read GetMethod write SetMethod; string read GetReasonPhrase;
Client
Methods
Create Declaration public constructor Create; virtual; abstract; Description Creates an instance of a TBrookHTTPDef(12.4) class. Register Declaration public class procedure Register; Description Register the broker class. Unregister Declaration public class procedure Unregister; Description Unregister the broker class. GetLibrary Declaration public class function GetLibrary: string; virtual; abstract;
Description Get the broker library name, for example: FCLWeb, Synapse, LNet, Indy etc. AddHeader Declaration public procedure AddHeader(const AName, AValue: Description Adds header, replacing an existing one if it exists. Request Declaration public function Request: Description Sends request to server. Get Declaration public class function Get(const AUrl: Boolean; virtual; abstract; string; AResponse: TStream): Boolean; virtual; abstract; string); virtual; abstract;
74
Post Declaration public class function Post(const AUrl: Boolean; virtual; abstract; string; AResponse: TStream):
Description Sends request by a POST HTTP request method. Put Declaration public class function Put(const AUrl: Boolean; virtual; abstract; string; AResponse: TStream):
Description Sends request by a PUT HTTP request method. Delete Declaration public class function Delete(const AUrl: Boolean; virtual; abstract; string; AResponse: TStream):
Description Sends request by a DELETE HTTP request method. Options Declaration public class function Options(const AUrl: Boolean; virtual; abstract; string; AResponse: TStream):
Description Sends request by a OPTIONS HTTP request method. Head Declaration public class function Head(const AUrl: Boolean; virtual; abstract; string; AHeaders: TStrings):
Description Sends request by a HEAD HTTP request method. PostForm Declaration public class function PostForm(const AUrl: TStream): Boolean; virtual; abstract; string; AFormData, AResponse:
Description Sends request by a POST HTTP request method, passing a form-data as parameter. PostForm Declaration public class function PostForm(const AUrl, AFormData: TStream): Boolean; virtual; abstract; string; AResponse:
Description Sends request by a POST HTTP request method, passing a form-data as parameter.
75
PostFile Declaration public class function PostFile(const AUrl, AFieldName, AFileName: AFile, AResponse: TStream): Boolean; virtual; abstract; Description Sends request by a POST HTTP request method, passing a le as parameter. PostFile Declaration public class function PostFile(const AUrl, AFieldName, AFileName: AResponse: TStream): Boolean; virtual; abstract; Description Sends request by a POST HTTP request method, passing a le as parameter. string; string;
Description
Registers HTTP denitions.
Methods
Service Declaration public class function Service: TBrookHTTPDefs;
Description Registers the service provided by this class. Find Declaration public function Find(const ALibrary: Description Finds a database item by its library name. ItemByLibrary Declaration public function ItemByLibrary(const ALibrary: Description Returns a database item by its library name. string): TBrookHTTPDefClass; string): TBrookHTTPDefClass;
76
Description
Client to perform HTTP requests.
Methods
Create Declaration public constructor Create(const ALibrary: string);
Description Creates an instance of a TBrookHTTPClient(12.4) class. SetLibrary Declaration public class procedure SetLibrary(const ALibrary: Description Species the library to be used by this class. Prepare Declaration public class procedure Prepare(out AHttp: Description Prepares an instance of TBrookHTTPDef. Get Declaration public class function Get(const AUrl: Boolean; string; AResponse: TStream): TBrookHTTPDef); string);
Description Sends request by a GET HTTP request method. Post Declaration public class function Post(const AUrl: Boolean; string; AResponse: TStream):
Description Sends request by a POST HTTP request method. Put Declaration public class function Put(const AUrl: Boolean; string; AResponse: TStream):
Description Sends request by a PUT HTTP request method. Delete Declaration public class function Delete(const AUrl: Boolean; string; AResponse: TStream):
Options Declaration public class function Options(const AUrl: Boolean; string; AResponse: TStream):
Description Sends request by a OPTIONS HTTP request method. Head Declaration public class function Head(const AUrl: Boolean; string; AHeaders: TStrings):
Description Sends request by a HEAD HTTP request method. PostForm Declaration public class function PostForm(const AUrl: TStream): Boolean; string; AFormData, AResponse:
Description Sends request by a POST HTTP request method, passing a form-data as parameter. PostForm Declaration public class function PostForm(const AUrl, AFormData: TStream): Boolean; string; AResponse:
Description Sends request by a POST HTTP request method, passing a form-data as parameter. PostFile Declaration public class function PostFile(const AUrl, AFieldName, AFileName: AFile, AResponse: TStream): Boolean; Description Sends request by a POST HTTP request method, passing a le as parameter. PostFile Declaration public class function PostFile(const AUrl, AFieldName, AFileName: AResponse: TStream): Boolean; Description Sends request by a POST HTTP request method, passing a le as parameter. Request Declaration public function Request(AHttp: TBrookHTTPDef): TBrookHTTPResult; string; string;
78
Description Performs the request, passing the method and URL as parameter. Request Declaration public function Request(const AUrl: string): TBrookHTTPResult;
12.5
Types
TBrookHTTPDefClass
Declaration TBrookHTTPDefClass = class of TBrookHTTPDef; Description Is a metaclass for TBrookHTTPDef(12.4) class.
TBrookHTTPDefsClass
Declaration TBrookHTTPDefsClass = class of TBrookHTTPDefs; Description Is a metaclass for TBrookHTTPDefs(12.4) class.
TBrookHTTPClientClass
Declaration TBrookHTTPClientClass = class of TBrookHTTPClient; Description Is a metaclass for TBrookHTTPClient(12.4) class.
79
Chapter 13
Unit BrookHTTPConsts
13.1 Description
Brook HTTP consts. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13.2
Uses
BrookConsts(6)
13.3
Constants
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
13.4
Variables
97
Chapter 14
Unit BrookHTTPUtils
14.1 Description
Brook HTTP Utils unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14.2
Uses
98
14.3
Overview
BrookDateTimeToGMT Converts TDateTime to a GMT format. BrookSameURL Compare two URLs ignoring a possible nal slash. BrookStatusCodeToReasonPhrase Returns the reason phrase corresponding to a status code. BrookReasonPhraseToStatusCode Returns the status code corresponding to a reason phrase. BrookGetAcceptEncodingSet Returns a set of HTTP AceptEnconding header. BrookGetAcceptEncoding Returns a string of HTTP AcceptEnconding. BrookMimeTypeFromFileExt Returns a MIME type by le extension. BrookMimeTypeFromFileName Returns a MIME type by le name. BrookFileExtFromMimeType Returns a le extension by MIME type. BrookExtractUrlFileName Extracts the le name of a URL. BrookExtractUrlFileName Extracts the le name of a URL and escapes it. BrookRequestMethodToStr Returns the string corresponding to a TBrookRequestMethod. BrookStrToRequestMethod Returns the TBrookRequestMethod corresponding to a string. BrookHttpRequest Perform HTTP requests. BrookHttpRequest Perform HTTP requests returning the response as TJSONData. BrookHttpRequest Perform HTTP requests returning the response as TJSONArray. BrookHttpRequest Perform HTTP requests returning the response as TJSONObject. BrookHttpRequest Perform HTTP requests passing the data as TJSONData. BrookHttpRequest Perform HTTP requests passing the data as TJSONObject.
14.4
BrookDateTimeToGMT
Declaration function BrookDateTimeToGMT(const ADateTime: Description Converts TDateTime to a GMT format.
BrookSameURL
Declaration function BrookSameURL(AURL1, AURL2: string): Boolean; Description Compare two URLs ignoring a possible nal slash. 99
BrookStatusCodeToReasonPhrase
Declaration function BrookStatusCodeToReasonPhrase(const AStatusCode: Description Returns the reason phrase corresponding to a status code. Word): string;
BrookReasonPhraseToStatusCode
Declaration function BrookReasonPhraseToStatusCode(const AReasonPhrase: Description Returns the status code corresponding to a reason phrase. string): Word;
BrookGetAcceptEncodingSet
Declaration function BrookGetAcceptEncodingSet( const AAcceptEncoding: TBrookAcceptEncodingSet; Description Returns a set of HTTP AceptEnconding header. ShortString):
BrookGetAcceptEncoding
Declaration function BrookGetAcceptEncoding( const AAcceptEncoding: TBrookAcceptEncodingSet): string; Description Returns a string of HTTP AcceptEnconding.
BrookMimeTypeFromFileExt
Declaration function BrookMimeTypeFromFileExt(const AValue: Description Returns a MIME type by le extension. string): string;
BrookMimeTypeFromFileName
Declaration function BrookMimeTypeFromFileName(const AValue: Description Returns a MIME type by le name. string): string;
BrookFileExtFromMimeType
Declaration function BrookFileExtFromMimeType(const AValue: Description Returns a le extension by MIME type. string): string;
BrookExtractUrlFileName
Declaration function BrookExtractUrlFileName(const AUrl: Description Extracts the le name of a URL. string): string;
100
BrookExtractUrlFileName
Declaration function BrookExtractUrlFileName(const AUrl: AEscapeQueryString: Boolean): string; Description Extracts the le name of a URL and escapes it. string; const
BrookRequestMethodToStr
Declaration function BrookRequestMethodToStr(const AMethod: string; TBrookRequestMethod):
BrookStrToRequestMethod
Declaration function BrookStrToRequestMethod(const AMethod: TBrookRequestMethod; string):
BrookHttpRequest
Declaration function BrookHttpRequest(const AUrl: string; const AMethod: TBrookRequestMethod = rmGet; const AHttpClientLibrary: string = ES): TBrookHTTPResult; Description Perform HTTP requests. (allows all request methods)
BrookHttpRequest
Declaration function BrookHttpRequest(const AUrl: string; out AResponse: TJSONData; const AMethod: TBrookRequestMethod = rmGet; const AHttpClientLibrary: string = ES): TBrookHTTPResult; Description Perform HTTP requests returning the response as TJSONData. (allows request methods: GET, HEAD, OPTIONS and TRACE)
BrookHttpRequest
Declaration function BrookHttpRequest(const AUrl: string; out AResponse: TJSONArray; const AMethod: TBrookRequestMethod = rmGet; const AHttpClientLibrary: string = ES): TBrookHTTPResult; Description Perform HTTP requests returning the response as TJSONArray. (allows request methods: GET, HEAD, OPTIONS and TRACE)
101
BrookHttpRequest
Declaration function BrookHttpRequest(const AUrl: string; out AResponse: TJSONObject; const AMethod: TBrookRequestMethod = rmGet; const AHttpClientLibrary: string = ES): TBrookHTTPResult; Description Perform HTTP requests returning the response as TJSONObject. (allows request methods: GET, HEAD, OPTIONS and TRACE)
BrookHttpRequest
Declaration function BrookHttpRequest(var AData: TJSONData; const AUrl: string; const AMethod: TBrookRequestMethod = rmPost; const AHttpClientLibrary: string = ES; const AEncodeData: Boolean = True): TBrookHTTPResult; Description Perform HTTP requests passing the data as TJSONData. (allows request methods: POST, PUT and DELETE)
BrookHttpRequest
Declaration function BrookHttpRequest(var AData: TJSONObject; const AUrl: string; const AMethod: TBrookRequestMethod = rmPost; const AHttpClientLibrary: string = ES; const AEncodeData: Boolean = True): TBrookHTTPResult; Description Perform HTTP requests passing the data as TJSONObject. (allows request methods: POST, PUT and DELETE)
14.5
Types
TBrookAcceptEncodingSet
Declaration TBrookAcceptEncodingSet = set of (aeDeflate, aeGzip, aeSdch, aeXGzip); Description Denes a set to represent the AcceptEncoding HTTP header.
102
Chapter 15
Unit BrookJSONHelper
15.1 Description
Brook JSON Helper unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15.2
Uses
15.3
Overview
TBrookJSONDataHelper Class Adds features to the TJSONData class. TBrookJSONObjectHelper Class Adds features to the TJSONObject class.
103
15.4
Description
Adds features to the TJSONData class.
Properties
AsChar public property AsChar: Char read GetAsChar write SetAsChar; Get or set the JSONData as a Char. AsSmallInt public property AsSmallInt: SetAsSmallInt; SmallInt read GetAsSmallInt write
Get or set the JSONData as a SmallInt. AsTime public property AsTime: TTime read GetAsTime write SetAsTime;
Get or set the JSONData as a TTime. AsDate public property AsDate: TDate read GetAsDate write SetAsDate;
Get or set the JSONData as a TDate. AsDateTime public property AsDateTime: SetAsDateTime; TDateTime read GetAsDateTime write
Get or set the JSONData as a TDateTime. AsTrimStr public property AsTrimStr: string read GetAsTrimStr write SetAsTrimStr;
Get or set the JSONData as a trimmed string. AsTrimJS public property AsTrimJS: string read GetAsTrimJS write SetAsTrimJS; Get or set the JSONData as a trimmed JSON string. AsLowerStr public property AsLowerStr: string read GetAsLowerStr write SetAsLowerStr;
Get or set the JSONData as a lower string. AsLowerJS public property AsLowerJS: string read GetAsLowerJS write SetAsLowerJS; Get or set the JSONData as a lower JSON string. AsUpperStr public property AsUpperStr: string read GetAsUpperStr write SetAsUpperStr;
Get or set the JSONData as a upper string. AsUpperJS public property AsUpperJS: string read GetAsUpperJS write SetAsUpperJS; Get or set the JSONData as a upper JSON string. 104
Get or set the JSONData as a quoted string. AsMD5 public property AsMD5: string read GetAsMD5 write SetAsMD5;
Get or set the JSONData as a MD5 string. AsSHA1 public property AsSHA1: string read GetAsSHA1 write SetAsSHA1;
Get or set the JSONData as a SHA1 string. IsEmpty public property IsEmpty: Boolean read GetIsEmpty;
Get if the JSONData is an empty string. IsBlank public property IsBlank: Boolean read GetIsBlank;
Description
Adds features to the TJSONObject class.
Properties
Times public property Times[AName: Get or set a value as TTime. Dates public property Dates[AName: Get or set a value as TDate. DateTimes public property DateTimes[AName: SetDateTimes; Get or set a value as TDateTime. string]: TTime read GetDateTimes write string]: TTime read GetDates write SetDates; string]: TTime read GetTimes write SetTimes;
Methods
Exists Declaration public function Exists(const AName: Description Checks if a name exists. string): Boolean;
105
Chapter 16
Unit BrookMessages
16.1 Description
Brook Messages unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16.2
Uses
16.3
Overview
EBrookMessage Class Handles exceptions for TBrookMessage(16.4). EBrookMessages Class Handles exceptions for TBrookMessages(16.4). TBrookMessage Class Handles strings for translation of messages. TBrookMessages Class Registers the available language in the framework. BrookSetDefaultLanguage Translates the framework messages acoording to the default language. 106
16.4
Description
Handles exceptions for TBrookMessage(16.4).
Description
Handles exceptions for TBrookMessages(16.4).
Description
Handles strings for translation of messages.
Methods
Register Declaration public class procedure Register; Description Register the broker class. Translate Declaration public class procedure Translate; virtual; abstract; Description Translates the framework messages. CountryCode Declaration public class function CountryCode: ShortString; virtual; abstract;
Description
Registers the available language in the framework.
Properties
Items public property Items[const AIndex: write SetItems; The list of translation items. Integer]: TBrookMessageClass read GetItems
Methods
Create Declaration public constructor Create; Description Creates an instance of a TBrookMessages(16.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookMessages(16.4) class. RegisterService Declaration public class procedure RegisterService; Description Registers the service provided by this class. UnregisterService Declaration public class procedure UnregisterService; Description Unregisters the service provided by this class.
108
Service Declaration public class function Service: Description Return a instance of this class. Count Declaration public function Count: Integer; TBrookMessages;
Description Returns the number of registered translations. SetLanguage Declaration public procedure SetLanguage(const ACountryCode: ShortString);
Description Translates the framework messages acoording to the country code. Find Declaration public function Find(const ACountryCode: Description Finds a translation item by its country code. ItemByCountryCode Declaration public function ItemByCountryCode( const ACountryCode: TBrookMessageClass; Description Returns a translation item by its country code. Add Declaration public procedure Add(AClass: Description Adds a translation item. Remove Declaration public procedure Remove(AClass: Description Removes a translation item. TBrookMessageClass); TBrookMessageClass); ShortString): ShortString): TBrookMessageClass;
16.5
BrookSetDefaultLanguage
Declaration procedure BrookSetDefaultLanguage; Description Translates the framework messages acoording to the default language. 109
16.6
Types
TBrookMessageClass
Declaration TBrookMessageClass = class of TBrookMessage; Description Is a metaclass for TBrookMessage(16.4) class.
TBrookMessagesClass
Declaration TBrookMessagesClass = class of TBrookMessages; Description Is a metaclass for TBrookMessages(16.4) class.
16.7
Variables
string = ES;
SBrookInvalidRequestMethodError
Declaration SBrookInvalidRequestMethodError:
SBrookItemNotFoundError
Declaration SBrookItemNotFoundError: string = ES;
SBrookFileNotFoundError
Declaration SBrookFileNotFoundError: string = ES;
SBrookNoRequestMethodError
Declaration SBrookNoRequestMethodError: string = ES;
SBrookNoApplicationRegisteredError
Declaration SBrookNoApplicationRegisteredError: string = ES;
SBrookApplicationAlreadyRegisteredError
Declaration SBrookApplicationAlreadyRegisteredError: string = ES;
SBrookRegiterTBrookActionError
Declaration SBrookRegiterTBrookActionError: string = ES;
SBrookActionAlreadyRegisteredError
Declaration SBrookActionAlreadyRegisteredError: string = ES;
110
SBrookDefaultActionAlreadyRegisteredError
Declaration SBrookDefaultActionAlreadyRegisteredError: string = ES;
SBrookPatternAlreadyRegisteredError
Declaration SBrookPatternAlreadyRegisteredError: string = ES;
SBrookRouterAlreadyRegisteredError
Declaration SBrookRouterAlreadyRegisteredError: string = ES;
SBrookNoRouterRegisteredError
Declaration SBrookNoRouterRegisteredError: string = ES;
SBrookMessagesAlreadyRegisteredError
Declaration SBrookMessagesAlreadyRegisteredError: string = ES;
SBrookNoMessagesRegisteredError
Declaration SBrookNoMessagesRegisteredError: string = ES;
SBrookNoRouteRegisteredError
Declaration SBrookNoRouteRegisteredError: string = ES;
SBrookCfgFileNotFoundError
Declaration SBrookCfgFileNotFoundError: string = ES;
SBrookNilJSONParamError
Declaration SBrookNilJSONParamError: string = ES;
SBrookNilParamError
Declaration SBrookNilParamError: string = ES;
SBrookDataBaseAlreadyRegisteredError
Declaration SBrookDataBaseAlreadyRegisteredError: string = ES;
SBrookNoDataBaseRegisteredError
Declaration SBrookNoDataBaseRegisteredError: string = ES;
111
SBrookNoQueryBrokerClassRegisteredError
Declaration SBrookNoQueryBrokerClassRegisteredError: string = ES;
SBrookEmptyTableNameError
Declaration SBrookEmptyTableNameError: string = ES;
SBrookEmptyLibraryNameError
Declaration SBrookEmptyLibraryNameError: string = ES;
SBrookEmptyCountryCodeError
Declaration SBrookEmptyCountryCodeError: string = ES;
SBrookMethodNotAllowedError
Declaration SBrookMethodNotAllowedError: string = ES;
SBrookIncompatibleTypesError
Declaration SBrookIncompatibleTypesError: string = ES;
112
Chapter 17
Unit BrookQuery
17.1 Description
Brook Query unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17.2
Uses
BrookClasses(4) BrookDataBase(7) BrookException(11) BrookMessages(16) BrookConsts(6) BrookDBConsts(9) DB SQLdb FPJSON JSONParser SysUtils
113
Classes Variants
17.3
Overview
EBrookQuery Class Handles exceptions for TBrookQuery(17.4). TBrookQuery Class Handles database queries.
17.4
Description
Handles exceptions for TBrookQuery(17.4).
Description
Handles database queries.
Properties
SQL public property SQL: TStrings read GetSQL; Is the SQL statement. Fields public property Fields: Are the query elds. Params public property Params: Are the query parameters. BOF public property BOF: Boolean read GetBOF; Checks if the cursor is at the rst register. EOF public property EOF: Boolean read GetEOF; Checks if the cursor is at the last register. 114 TParams read GetParams; TFields read GetFields;
Bookmark
Modied
Returns True if the content of the query has changed. State public property State: Get the current query state. Active public property Active: Checks if the query is active. DataSet public property DataSet: Get the dataset of the query. FieldDefs public property FieldDefs: Get the eldefs of the query. DataSource public property DataSource: SetDataSource; TDataSource read GetDataSource write TFieldDefs read GetFieldDefs; TDataSet read GetDataSet; Boolean read GetActive write SetActive; TDataSetState read GetState;
Get or set a master query datasource. DataBase public property DataBase: SetDataBase; Get or set a query database. DateAsString public property DateAsString: FDateAsString; Enables the date saving as string. AsJSON public property AsJSON: TJSONStringType read GetAsJSON write SetAsJSON; Returns a JSON string with the query registers. Rows public property Rows: TJSONArray read GetRows; Boolean read FDateAsString write TBrookDataBase read GetDataBase write
Returns a JSON array with the query registers. Row public property Row: TJSONObject read GetRow;
Returns the current register in a JSON object. Position public property Position: LongInt read GetPosition write SetPosition;
115
Methods
Init Declaration public constructor Init(ADataBase: TBrookDataBase); virtual; abstract;
Description Creates an instance of a TBrookQuery(17.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookQuery(17.4) class. Create Declaration public class function Create(ADataBase: TBrookDataBase): TBrookQuery;
Description Creates an instance of a TBrookQuery(17.4) class. InitBrokerClass Declaration public class procedure InitBrokerClass; Description Initializes the class broker. BrokerClass Declaration public class function BrokerClass: Description Registers the broker class. GetJSONType Declaration public class function GetJSONType(const AFieldClass: ShortString; Description Returns a JSON type according to a eld class. GetJSONType Declaration public class function GetJSONType(const AField: Description Returns a JSON type according to a eld type. JSONToFields Declaration public class procedure JSONToFields(AJSON: TJSONObject; AFields: const ADateAsString: Boolean); Description Set the content of a JSON object to elds. 116 TFields; TField): ShortString; TFieldClass): TBrookQueryClass; virtual;
FieldsToJSON Declaration public class procedure FieldsToJSON(AFields: const ADateAsString: Boolean); Description Set the content of elds to a JSON object. DataSetToJSON Declaration public class procedure DataSetToJSON(ADataSet: const ADateAsString: Boolean); Description Set the content of a dataset to a JSON array. JSONToParams Declaration public class procedure JSONToParams(AJSON: TJSONObject; AParams: AFieldDefs: TFieldDefs; const ADateAsString, AAutoCreateParams: Description Set the content of a JSON object to params. FieldDefsToSchema Declaration public class procedure FieldDefsToSchema(AFieldDefs: TJSONObject); overload; Description Set the content of eldsdefs to a JSON object. FieldDefsToSchema Declaration public class procedure FieldDefsToSchema(AFieldDefs: ASchema: TJSONStringType); overload; Description Set the content of eldsdefs to a JSON string. GetJSONAttributes Declaration public class procedure GetJSONAttributes(AJSON: TJSONObject; out ANames: string; out AValues: Variant; const ADelimiter: Char = SC); Description Get the attributes of a JSON object and converts into a variant. GetSchema Declaration public procedure GetSchema(out ASchema: Description Returns a JSON object with the query columns. TJSONObject); overload; TFieldDefs; out TFieldDefs; ASchema: TParams; Boolean); TDataSet; AJSON: TJSONArray; TFields; AJSON: TJSONObject;
117
Description Returns a JSON string with the query columns. Locate Declaration public class function Locate(ADataSet: TDataSet; const AJSON: TJSONObject; const AOptions: TLocateOptions): Boolean; overload; Description Locates a register from a JSON object. GetRows Declaration public function GetRows(out AJSON: TJSONArray): Description Get all the rows of a query in a JSON array. GetRow Declaration public function GetRow(out AJSON: TJSONObject): Description Get the current register in a JSON object. SetRows Declaration public function SetRows(AJSON: TJSONArray): Description Inserts registers from a JSON array. SetRow Declaration public function SetRow(AJSON: TJSONObject): Description Inserts one register from a JSON object. Bind Declaration public function Bind(AJSON: TJSONObject): Description Binds a JSON object to the parameters. ApplyUpdates Declaration public function ApplyUpdates: TBrookQuery; virtual; abstract; TBrookQuery; TBrookQuery; TBrookQuery; TBrookQuery; TBrookQuery;
118
Description Cancels all the updates stored in the buer. Apply Declaration public function Apply(const ARetaining: virtual; abstract; Boolean = False): TBrookQuery;
Description Applies the updates stored in the buer and commits the transaction. Undo Declaration public function Undo(const ARetaining: virtual; abstract; Boolean = False): TBrookQuery;
Description Undoes the updates stored in the buer and rollbacks the transaction. Commit Declaration public function Commit(const ARetaining: virtual; abstract; Description Commits the transaction. Rollback Declaration public function Rollback(const ARetaining: virtual; abstract; Description Rollbacks the transaction. Append Declaration public function Append(AJSON: TJSONObject): Description Adds a JSON object to the end of registers. Insert Declaration public function Insert(AJSON: TJSONObject): Description Inserts a JSON object in the current position. Edit Declaration public function Edit(AJSON: TJSONObject): TBrookQuery; TBrookQuery; TBrookQuery; Boolean = False): TBrookQuery; Boolean = False): TBrookQuery;
Cancel Declaration public function Cancel: Description Cancels editions in the query. Delete Declaration public function Delete: Description Deletes the current register. Open Declaration public function Open: Description Opens the query. Close Declaration public function Close: Description Closes the query. Refresh Declaration public function Refresh: Description Refreshes the query. First Declaration public function First: TBrookQuery; TBrookQuery; TBrookQuery; TBrookQuery; TBrookQuery; TBrookQuery;
Description Goes to the query rst register. Prior Declaration public function Prior: TBrookQuery;
Description Goes to the query previous register. Next Declaration public function Next: TBrookQuery;
120
Description Goes to the query last register. Post Declaration public function Post: TBrookQuery;
Description Applies editions to the query. Execute Declaration public function Execute: Description Executes the query. RowsAected Declaration public function RowsAffected: Description Get the number of changed registers. Locate Declaration public function Locate(const AJSON: TJSONObject; const AOptions: TLocateOptions = []): Boolean; overload; Description Locates a register by means of JSON object. Locate Declaration public function Locate(const AKeyFields: string; const AKeyValues: Variant; const AOptions: TLocateOptions = []): Boolean; overload; Description Locates a register passing a key and a value. Param Declaration public function Param(const AName: Description Get a query parameter. Field Declaration public function Field(const AName: Description Get a query eld. 121 string): TField; virtual; abstract; string): TParam; virtual; abstract; TRowsCount; virtual; abstract; TBrookQuery; virtual; abstract;
FieldDef Declaration public function FieldDef(const AName: abstract; Description Get a query elddef. Count Declaration public function Count: Description Get the number of registers. GetBookmark Declaration public function GetBookmark: Description Creates a bookmark. GotoBookmark Declaration public procedure GotoBookmark(ABookmark: Description Goes to a bookmark. TBookmark); TBookmark; Int64; string): TFieldDef; virtual;
17.5
Types
TBrookQueryClass
Declaration TBrookQueryClass = class of TBrookQuery; Description Is a metaclass for TBrookQuery(17.4) class.
122
Chapter 18
Unit BrookRequestHelper
18.1 Description
Brook Request Helper unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18.2
Uses
18.3
Overview
123
18.4
Description
Adds features to TRequest class.
Properties
Path public property Path[const AIndex: Integer]: string read GetPath; Get the current path, script name and pathinfo included.
Methods
SetScheme Declaration public class procedure SetScheme(const AScheme: ShortString);
Description Set the URL scheme (HTTP or HTTPs) in GetFullURL function. GetScheme Declaration public class function GetScheme: ShortString;
Description Get the current URL scheme (HTTP or HTTPs). GetPath Declaration public function GetPath(const AIndex: Integer): string;
Description Get the path level passing the respective index. Exemple: BrookGetPathLavel(/a/b/c/, 1) = b. IsGet Declaration public function IsGet: Boolean;
Description Checks if the request was done under the GET method. IsPost Declaration public function IsPost: Boolean;
Description Checks if the request was done under the POST method. 124
Description Checks if the request was done under the PUT method. IsDelete Declaration public function IsDelete: Boolean;
Description Checks if the request was done under the DELETE method. IsHead Declaration public function IsHead: Boolean;
Description Checks if the request was done under the HEAD method. IsOptions Declaration public function IsOptions: Boolean;
Description Checks if the request was done under the OPTIONS method. IsAjax Declaration public function IsAjax: Boolean;
Description Checks if the request was done by means of Ajax. IsXhr Declaration public function IsXhr: Boolean;
Description Checks if the request was done by means of Xhr. IsForm Declaration public function IsForm: Boolean;
Description Checks if the request was done by means of a HTML form. IsFormData Declaration public function IsFormData: Boolean;
Description Checks if the request was done by means of a HTML data form.
125
OverriddenMethod Declaration public function OverriddenMethod: Description Get X-HTTP-Method-Override header GetHostWithPort Declaration public function GetHostWithPort: string; ShortString;
Description Get the URL and the port separated by a :, exemple: http://localhost:80 GetPath Declaration public function GetPath: Description Get the current path. GetFullURL Declaration public function GetFullURL: string; Description Get the full URL, schema included. GetURLWithScriptName Declaration public function GetURLWithScriptName: string; string;
Description Get the full URL, schema and script name included. GetIP Declaration public function GetIP: ShortString; Description Get the IP of the requester. GetDocumentRoot Declaration public function GetDocumentRoot: string;
Description Get the server path where HTML documents can be placed. Variable Declaration public function Variable(const AName: Description Get a environment variable given its name. Variables Declaration public procedure Variables(out AValues: Description Get a list with all environment variables. TStrings); string): string;
126
Chapter 19
Unit BrookResponseHelper
19.1 Description
Brook Response Helper unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19.2
Uses
19.3
Overview
EBrookResponseHelper Class Handles exceptions for TBrookResponseHelper(19.4). TBrookResponseHelper Class Adds features to TResponse class. 127
19.4
Description
Handles exceptions for TBrookResponseHelper(19.4).
Description
Adds features to TResponse class.
Properties
Header public property Header[AName: Get or set a HTTP header. Status public property Status: Integer read GetStatus write SetStatus; string]: string read GetHeader write SetHeader;
Methods
IsEmpty Declaration public function IsEmpty: Description Is this a empty response? IsInformational Declaration public function IsInformational: Description Is this an informational response? IsOK Declaration public function IsOK: Boolean; Description Is this a 200 OK response? Boolean; Boolean;
128
IsSuccessful Declaration public function IsSuccessful: Description Is this a 2xx successful response? IsRedirection Declaration public function IsRedirection: Description Is this a 3xx redirection response? IsRedirect Declaration public function IsRedirect: Boolean; Boolean; Boolean;
Description Is this a specic redirect response? (301, 302, 303, 307) IsForbidden Declaration public function IsForbidden: Description Is this a forbidden response? IsNotFound Declaration public function IsNotFound: Description Is this a 404 not found response? IsClientError Declaration public function IsClientError: Description Is this a client error response? IsServerError Declaration public function IsServerError: Description Is this a server error response? AddContentDisposition Declaration public procedure AddContentDisposition(const AContentType: ShortString; const AFileName: TFileName = ES; const ADispositionType: ShortString = BROOK HTTP CONTENT DISPOSITION ATTACHMENT; const AContentDescription: ShortString = ES; const AModificationDate: TDateTime = NullDate); Description Denes a content disposition for a le. Boolean; Boolean; Boolean; Boolean;
129
Chapter 20
Unit BrookRESTActions
20.1 Description
Brook REST Actions unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20.2
Uses
20.3
Overview
TBrookOptionsAction Class Displays the schema of the resource. TBrookRetrieveAction Class Displays all the contents of the resource. TBrookShowAction Class Displays the content of a specic resource.
130
TBrookCreateAction Class Creates a new resource. TBrookUpdateAction Class Updates a specic resource. TBrookDestroyAction Class Destroy a specic resource.
20.4
Description
Displays the schema of the resource.
Methods
Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod = rmOptions; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod = rmOptions; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. Request Declaration public procedure Request(ARequest: override; TRequest; AResponse: TResponse);
Description Is triggered by a OPTIONS HTTP request method. Execute Declaration public function Execute: Boolean; virtual;
Description Executes the action. If there are schema in the resource, they are returned, if not, it returns a { "error": "No schema." } JSON. 131
Description
Displays all the contents of the resource.
Methods
Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod = rmGet; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod = rmGet; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. Request Declaration public procedure Request(ARequest: override; TRequest; AResponse: TResponse);
Description Is triggered by a request of any HTTP method. Execute Declaration public function Execute: Boolean; virtual;
Description Executes the action. If there are contents in the resource, they are returned, if not, it returns a 404 status code.
Description
Displays the content of a specic resource.
Methods
Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod = rmGet; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod = rmGet; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. Request Declaration public procedure Request(ARequest: override; TRequest; AResponse: TResponse);
Description Is triggered by a request of any HTTP method. Execute Declaration public function Execute: Boolean; virtual;
Description Executes the action. If there are contents in the resource, they are returned, if not, it returns a 404 status code.
Description
Creates a new resource.
133
Methods
Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod = rmPost; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod = rmPost; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. Request Declaration public procedure Request(ARequest: override; TRequest; AResponse: TResponse);
Description Is triggered by a request of any HTTP method. Execute Declaration public function Execute: Boolean; virtual;
Description Executes the action. The 201 status code is always returned.
Description
Updates a specic resource.
Methods
Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod = rmPut; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. 134
Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod = rmPut; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. Request Declaration public procedure Request(ARequest: override; TRequest; AResponse: TResponse);
Description Is triggered by a request of any HTTP method. Execute Declaration public function Execute: Boolean; virtual;
Description Executes the action. If the edition is successful, the 204 status code is returned, if not, the code is 201.
Description
Destroy a specic resource.
Methods
Register Declaration public class procedure Register(const ATableName, APattern: string; const AMethod: TBrookRequestMethod = rmDelete; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table. Register Declaration public class procedure Register(const ATableName, APattern, AIgnoredFields: string; const AMethod: TBrookRequestMethod = rmDelete; const ADefault: Boolean = False); overload; Description Registers an action linking the request to a database table and dening the elds that will be ignored for persistance purposes. 135
Description Is triggered by a request of any HTTP method. Execute Declaration public function Execute: Boolean; virtual;
Description Executes the action. If the deletion is successful, the 204 status code is returned, if not, the code is 404.
136
Chapter 21
Unit BrookRouter
21.1 Description
Brook Router unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21.2
Uses
BrookClasses(4) BrookException(11) BrookAction(1) BrookUtils(24) BrookConsts(6) BrookMessages(16) BrookHTTPConsts(13) HTTPDefs FPJSON Classes SysUtils StrUtils 137
21.3
Overview
EBrookRoutes Class Handles exceptions for TBrookRoutes(21.4). EBrookRouter Class Handles exceptions for TBrookRouter(21.4). TBrookRoute record Denes a route item. TBrookRoutes Class Denes a list of routes. TBrookRouter Class Provides features for the route handling.
21.4
Description
Handles exceptions for TBrookRoutes(21.4).
Description
Handles exceptions for TBrookRouter(21.4).
Fields
ActionClass ActionClass: TBrookActionClass; Species the class of the action to be called. Method Method: TBrookRequestMethod;
Species a HTTP request method of the action to be called. Pattern Pattern: string;
Description
Denes a list of routes.
Properties
Items public property Items[const AIndex: SetItems; The list of routes. List public property List: The router pointers list. TFPList read FList; Integer]: PBrookRoute read GetItems write
Methods
Create Declaration public constructor Create; Description Creates an instance of a TBrookRoutes(21.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookRoutes(21.4) class. Count Declaration public function Count: Integer;
Description Returns the number of registered routes. Add Declaration public function Add(AActionClass: TBrookActionClass; const APattern: string; const AMethod: TBrookRequestMethod; const ADefault: Boolean): Integer; Description Adds a route item.
139
GetDefaultActionClass Declaration public procedure GetDefaultActionClass(out AClass: AIndex: Integer); Description Get the default action class. PatternByActionClass Declaration public function PatternByActionClass(AClass: Description Get the registered pattern of a class. ActionClassByPattern Declaration public function ActionClassByPattern(const APattern: TBrookActionClass; Description Get the action class from a patter. ActionClassByClassName Declaration public function ActionClassByClassName(const AName: TBrookActionClass; Description Get an action class from its class name. string): string): TBrookActionClass): string; TBrookActionClass; out
Description
Provides features for the route handling.
Properties
Routes public property Routes: List of available routes. AfterExecuteAction public property AfterExecuteAction: TBrookExecuteActionEvent read FAfterExecuteAction write FAfterExecuteAction; Is triggered after the router executes a action. AfterMatchPattern public property AfterMatchPattern: TBrookMatchPatternEvent read FAfterMatchPattern write FAfterMatchPattern; Is triggered after the router matches a pattern. 140 TBrookRoutes read FRoutes write FRoutes;
AfterRoute
Is triggered after the router is routing. BeforeExecuteAction public property BeforeExecuteAction: TBrookExecuteActionEvent read FBeforeExecuteAction write FBeforeExecuteAction; Is triggered before the router executes a action. BeforeMatchPattern public property BeforeMatchPattern: TBrookMatchPatternEvent read FBeforeMatchPattern write FBeforeMatchPattern; Is triggered before the router matches a pattern. BeforeRoute public property BeforeRoute: write FBeforeRoute; TBrookRouteEvent read FBeforeRoute
Is triggered before the router is routing. OnExecuteAction public property OnExecuteAction: TBrookExecuteActionEvent read FOnExecuteAction write FOnExecuteAction; Is triggered when the router executes a action.
Methods
Create Declaration public constructor Create; virtual; Description Creates an instance of a TBrookRouter(21.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookRouter(21.4) class. GetServiceClass Declaration public class function GetServiceClass: Description Return the service class provided by this class. RegisterService Declaration public class procedure RegisterService; Description Registers the service provided by this class. TBrookRouterClass;
141
UnregisterService Declaration public class procedure UnregisterService; Description Unregisters the service provided by this class. Service Declaration public class function Service: Description Return a instance of this class. RootUrl Declaration public class function RootUrl: Description Return the root URL. RootUrl Declaration public class function RootUrl(ARequest: TRequest): string; string; TBrookRouter;
Description Return the root URL passing TRequest as param. MethodNotAllowed Declaration public class procedure MethodNotAllowed(AResponse: Description Sends the HTTP NotAllowed status code to the response. UrlFor Declaration public function UrlFor(AActionClass: array of string): string; overload; TBrookActionClass; const AParams: TResponse);
Description Creates an URL for an action informing an array of parameters. Exemple: procedure TMyAction.Get; begin // When calling with http://localhost/cgi-bin/cgi1/foo/myvalue // the output will be /cgi-bin/cgi1/foo/myvalue Write(UrlFor(TMyAction, [myvalue])); end; initialization TMyAction.Register(/foo/:myvar)
142
UrlFor Declaration public function UrlFor(AClassName: string): string; overload; string; const AParams: array of
Description Creates an URL for an action passing an array of parameters however informing the class name as string UrlFor Declaration public function UrlFor(AActionClass: TJSONData): string; overload; TBrookActionClass; const AParams:
Description Creates an URL for an action passing a JSON data. UrlFor Declaration public function UrlFor(AClassName: string; overload; string; const AParams: TJSONData):
Description Creates an URL for an action passing a JSON data however informing the class name as string. Canonicalize Declaration public function Canonicalize(ARequest: Boolean; TRequest; AResponse: TResponse):
Description Adds an slash to the end of the URL if does not exist. MatchPattern Declaration public function MatchPattern(APattern, APathInfo: string; out ARedirect: Boolean; out ANames, AValues: TBrookArrayOfString): Boolean; virtual; Description Checks if the given parameters match with a registered route. Route Declaration public procedure Route(ARequest: Description Runs the route processing. TRequest; AResponse: TResponse); virtual;
21.5
Types
TBrookRoutesClass
Declaration TBrookRoutesClass = class of TBrookRoutes; Description Is a metaclass for TBrookRoutes(21.4) class. 143
TBrookRouterClass
Declaration TBrookRouterClass = class of TBrookRouter; Description Is a metaclass for TBrookRouter(21.4) class.
PBrookRoute
Declaration PBrookRoute = ^TBrookRoute; Description Denes a pointer to the route item.
TBrookMatchPatternEvent
Declaration TBrookMatchPatternEvent = procedure(ASender: TObject; APattern, APathInfo: string; out ARedirect: Boolean; out ANames, AValues: TBrookArrayOfString) of object; Description Is a type to *MatchPattern event.
TBrookRouteEvent
Declaration TBrookRouteEvent = procedure(ASender: AResponse: TResponse) of object; Description Is a type to *Route event. TObject; ARequest: TRequest;
TBrookExecuteActionEvent
Declaration TBrookExecuteActionEvent = procedure(ASender: TObject; AAction: TBrookAction; ARequest: TRequest; AResponse: TResponse; ARoute: TBrookRoute; var AHandled: Boolean) of object; Description Is a type to *ExecuteAction event.
144
Chapter 22
Unit BrookSession
22.1 Description
Brook Session unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22.2
Uses
BrookClasses(4) BrookUtils(24) BrookException(11) BrookConsts(6) FPJSON JSONParser Classes SysUtils HTTPDefs DateUtils
145
22.3
Overview
EBrookSession Class Handles exceptions for TBrookSession(22.4). TBrookSession Class Denes features to the section handling.
22.4
Description
Handles exceptions for TBrookSession(22.4).
Description
Denes features to the section handling.
Properties
CookieName public property CookieName: Set the session cookie name. Directory public property Directory: string read FDirectory write FDirectory; string read FCookieName write FCookieName;
Set the name of directory session. Expired public property Expired: Boolean read IsExpired;
Returns True if the session has expired. SID public property SID: string read FSID; Get the ID session. Started public property Started: Boolean read IsStarted;
Checks if the session has started. FileName public property FileName: The session le name. TFileName read FFileName write FFileName;
146
FilePrex
Fields
TimeOut
The remaining seconds for the session end. HttpOnly public property HttpOnly: Boolean read FHttpOnly write FHttpOnly;
Informs if the session cookie is accessible only by HTTP requests, if True, the JavaScript access is not allowed.
Methods
Create Declaration public constructor Create; virtual; Description Creates an instance of a TBrookSession(22.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookSession(22.4) class. IsExpired Declaration public function IsExpired: Boolean; virtual;
Description Returns True if the session has expired. GenerateID Declaration public function GenerateID: string; virtual; Description Creates an ID for the session. Start Declaration public procedure Start(ARequest: Description Starts the session. TRequest); virtual;
147
Finish Declaration public procedure Finish(AResponse: Description Terminates the session. Expire Declaration public procedure Expire(ARequest: virtual; Description Expires the session. DeleteFiles Declaration public procedure DeleteFiles; Description Deletes the session les. Exists Declaration public function Exists(const AName: Description Checks if a name exists in elds. DeleteOldFiles Declaration public procedure DeleteOldFiles(const ABeforeOf: Description Deletes the session les except for the current session le. TDateTime); string): Boolean; TRequest; AResponse: TResponse); TResponse); virtual;
22.5
Types
TBrookSessionClass
Declaration TBrookSessionClass = class of TBrookSession; Description Is a metaclass for TBrookSession(22.4) class.
148
Chapter 23
Unit BrookTable
23.1 Description
Brook Table unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23.2
Uses
BrookClasses(4) BrookDataBase(7) BrookQuery(17) BrookException(11) BrookMessages(16) BrookConsts(6) BrookDBConsts(9) DB SQLdb FPJSON SysUtils
149
23.3
Overview
EBrookTable Class Handles exceptions for TBrookTable(23.4). TBrookTable Class Handles database tables.
23.4
Description
Handles exceptions for TBrookTable(23.4).
Description
Handles database tables.
Properties
Name public property Name: Denes the table name. BOF public property BOF: Boolean read GetBOF; Checks if the cursor is at the rst register. EOF public property EOF: Boolean read GetEOF; Checks if the cursor is at the last register. Bookmark public property Bookmark: Returns or creates a bookmark. Modied public property Modified: Boolean read GetModified; TBookmark read GetBookmark write GotoBookmark; string read FName write FName;
Returns True if the content of the table has changed. State public property State: Get the current table state. TDataSetState read GetState;
150
Active
DataSet
FieldDefs
DataSource
Get or set a master table datasource. DataBase public property DataBase: SetDataBase; Get or set a table database. DateAsString public property DateAsString: SetDateAsString; Enables the date saving as string. AsJSON public property AsJSON: TJSONStringType read GetAsJSON write SetAsJSON; Returns a JSON string with the table registers. Rows public property Rows: TJSONArray read GetRows; Boolean read GetDateAsString write TBrookDataBase read GetDataBase write
Returns a JSON array with the table registers. Row public property Row: TJSONObject read GetRow;
Returns the current register in a JSON object. Columns public property Columns[const AName: The list of table columns. Prepared public property Prepared: Boolean read IsPrepared; string]: TField read GetColumns;
Checks if a statement preparation is set. Fields public property Fields: Are the table elds. Params public property Params: Are the table parameters. Position public property Position: LongInt read GetPosition write SetPosition; TParams read GetParams; TFields read GetFields;
151
Methods
Create Declaration public constructor Create(ADataBase: string = ES); virtual; TBrookDataBase; const ATableName:
Description Creates an instance of a TBrookTable(23.4) class. Create Declaration public constructor Create(const ATableName: Description Creates an instance of a TBrookTable(23.4) class. Destroy Declaration public destructor Destroy; override; Description Frees an instance of TBrookTable(23.4) class. GetConditions Declaration public class procedure GetConditions(AJSON: TJSONObject; out AConditions: string); Description Receives an JSON object with parameters and creates a SQL where condition. GetSchema Declaration public procedure GetSchema(out ASchema: Description Returns a JSON object with the table columns. GetSchema Declaration public function GetSchema: TJSONStringType; overload; TJSONObject); overload; string = ES); reintroduce;
Description Returns a JSON string with the table columns. CreateFields Declaration public function CreateFields(AJSON: TJSONObject): Description Creates elddefs from a JSON Object. GetRows Declaration public function GetRows(out AJSON: TJSONArray): Description Get all the rows of a query in a JSON array. 152 TBrookTable; TBrookTable;
GetRow Declaration public function GetRow(out AJSON: TJSONObject): Description Get the current register in a JSON object. SetRows Declaration public function SetRows(AJSON: TJSONArray): Description Inserts registers from a JSON array. SetRow Declaration public function SetRow(AJSON: TJSONObject): Description Inserts one register from a JSON object. Bind Declaration public function Bind(AJSON: TJSONObject): Description Binds a JSON object to the parameters. ApplyUpdates Declaration public function ApplyUpdates: TBrookTable; TBrookTable; TBrookTable; TBrookTable; TBrookTable;
Description Applies all the changes stored in the buer. CancelUpdates Declaration public function CancelUpdates: TBrookTable;
Description Cancels all the updates stored in the buer. Apply Declaration public function Apply(const ARetaining: Boolean = False): TBrookTable;
Description Applies the updates stored in the buer and commits the transaction. Undo Declaration public function Undo(const ARetaining: Boolean = False): TBrookTable;
Description Undoes the updates stored in the buer and rollbacks the transaction.
153
Commit Declaration public function Commit(const ARetaining: Description Commits the transaction. Rollback Declaration public function Rollback(const ARetaining: Description Rollbacks the transaction. Append Declaration public function Append(AJSON: TJSONObject): Description Adds a JSON object to the end of registers. Insert Declaration public function Insert(AJSON: TJSONObject): Description Inserts a JSON object in the current position. Edit Declaration public function Edit(AJSON: TJSONObject): TBrookTable; TBrookTable; TBrookTable; Boolean = False): TBrookTable; Boolean = False): TBrookTable;
Description Edits the current register by means of a JSON object. Cancel Declaration public function Cancel: Description Cancels editions in the table. Delete Declaration public function Delete: Description Deletes the current register. Open Declaration public function Open: Description Opens the table. TBrookTable; TBrookTable; TBrookTable;
154
Close Declaration public function Close: Description Closes the table. Refresh Declaration public function Refresh: Description Refreshes the table. First Declaration public function First: TBrookTable; TBrookTable; TBrookTable;
Description Goes to the table rst register. Prior Declaration public function Prior: TBrookTable;
Description Goes to the table previous register. Next Declaration public function Next: TBrookTable;
Description Goes to the table next register. Last Declaration public function Last: TBrookTable;
Description Goes to the table last register. Clear Declaration public function Clear: TBrookTable;
Description Clears the SQL statements and close the table. Reset Declaration public function Reset: TBrookTable;
Description Clears the SQL statements, close the table and clears the elddefs.
155
Description Applies editions to the query. Locate Declaration public function Locate(AJSON: TJSONObject; const AOptions: []): Boolean; overload; Description Locates a register by means of JSON object. Locate Declaration public function Locate(const AKeyFields: string; const AKeyValues: Variant; const AOptions: TLocateOptions = []): Boolean; overload; Description Locates a register passing a key and a value. Find Declaration public function Find(AJSON: TJSONObject; const AOptions: []): TBrookTable; Description Finds a register by means of JSON object. Get Declaration public function Get(const AKeyValue: Description Gets a register passing a key value. Get Declaration public function Get(const AKeyName: TBrookTable; overload; Description Gets a register passing a key and a value. Field Declaration public function Field(const AName: Description Get a table eld. Param Declaration public function Param(const AName: Description Get a table parameter. 156 string): TParam; string): TField; string; const AKeyValue: Variant): Variant): TBrookTable; overload; TLocateOptions = TLocateOptions =
FieldDef Declaration public function FieldDef(const AName: Description Get a table elddef. Conditions Declaration public function Conditions(AJSON: TJSONObject): TBrookTable; string): TFieldDef;
Description Receives an JSON object with parameters and creates a SQL where condition. Count Declaration public function Count: Description Get the number of registers. RowsAected Declaration public function RowsAffected: Description Get the number of changed registers. Prepare Declaration public function Prepare: Description Composes a SQL statement. Unprepare Declaration public function Unprepare: TBrookTable; TBrookTable; TRowsCount; Int64;
Description Clears a SQL statement preparation. Select Declaration public function Select(const AFields: Description Composes a SELECT statement. Where Declaration public function Where(const AConditions: Description Composes a WHERE statement. string): TBrookTable; overload; string): TBrookTable;
157
Where Declaration public function Where(const AConditions: const): TBrookTable; overload; Description Composes a parametrized WHERE statement. OrderBy Declaration public function OrderBy(const AFields: Description Composes a ORDER BY statement. Empty Declaration public function Empty: Description Checks if table is empty. GetBookmark Declaration public function GetBookmark: Description Creates a bookmark. GotoBookmark Declaration public procedure GotoBookmark(ABookmark: Description Goes to a bookmark. TBookmark); TBookmark; Boolean; string): TBrookTable; string; const AArgs: array of
23.5
Types
TBrookTableClass
Declaration TBrookTableClass = class of TBrookTable; Description Is a metaclass for TBrookTable(23.4) class.
158
Chapter 24
Unit BrookUtils
24.1 Description
Brook Utils unit. Copyright (C) 2013 Silvio Clecio. http://brookframework.org All contributors: Plase see the le CONTRIBUTORS.txt, included in this distribution. See the le LICENSE.txt, included in this distribution, for details about the copyright. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24.2
Uses
24.3
Overview
159
BrookStartsChar Check whether a string starts with a given character. BrookEndsChar Check whether a string ends with a given character. BrookExtractPathLevels Get the next pathinfo level. BrookGetPathLevel Get the path level passing the respective index. BrookGetPathLevels Get the path from the level correspondent to the index to the last level. BrookMatchMethod Checks if a string is equivalent a enumerator representing a HTTP request method. BrookDeleteFiles Deletes les according to their creation dates and le names. BrookFileDate Get the datetime of a le. BrookFileSetDate Set the datetime of a le. BrookJSONCopy Copy the content of a JSON Object to another. BrookDumpStack Writes a backtrace of the current exception. BrookExcludeHTTPPathDelimiter Ensures URL ends with delimiter.
24.4
Fields
Mapped Mapped: Boolean; Enables the mapping of HTTP request methods. Charset Charset: ShortString;
Set the 404 HTML page. The string will be sent as is.
160
Page404File
Page404File:
string;
Set the 404 HTML page le. The le content will be sent. This has higher precedence than TBrookSettings.Page404 so when both are set, this will be processed rst and only if the le is not found or cannot be read the system will fallback to TBrookSettings.Page404 Page500 Page500File Page500: string; Set the 500 HTML page. The string will be sent as is. Page500File: string; Set the 500 HTML page le. The le content will be sent. This has higher precedence than TBrookSettings.Page500 so when both are set, this will be processed rst and only if the le is not found or cannot be read the system will fallback to TBrookSettings.Page500 DirectoryForUploads DirectoryForUploads: DeleteUploadedFiles DeleteUploadedFiles: KeepUploadedNames KeepUploadedNames: AcceptsJSONContent AcceptsJSONContent: Conguration RootUrl string; Set the default directory for uploads. Boolean; Denes if the temporary uploaded les will be deleted. Boolean; Keeps the original name of the uploaded les. Boolean; Denes if the application allows JSON formated requests. Configuration: string; Set a conguration for the application or for its object members. RootUrl: string; Set the default root URL. This is used by methods such as TBrookAction.UrlFor, TBrookActionHelper.LinkTo, TBrookActionHelper.ButtonTo etc. By default, Brook assumes SCRIPT NAME as root URL. Port OnError Port: Word; Set the default application port. OnError: TOnShowRequestException; Handles the application exceptions.
24.5
BrookStartsChar
Declaration function BrookStartsChar(const Ch: Description Check whether a string starts with a given character. 161
BrookEndsChar
Declaration function BrookEndsChar(const Ch: Char; const S: string): Boolean; Description Check whether a string ends with a given character.
BrookExtractPathLevels
Declaration procedure BrookExtractPathLevels(S: string; var R: string; out ALvl: string; out AEndDelim: Boolean; const ADelimiter: Char = US); Description Get the next pathinfo level.
BrookGetPathLevel
Declaration function BrookGetPathLevel(const APath: const ADelimiter: Char = US): string; string; const AIndex: SizeInt = 0;
Description Get the path level passing the respective index. Exemple: BrookGetPathLavel(/a/b/c/, 1) = b.
BrookGetPathLevels
Declaration function BrookGetPathLevels(const APath: string; const AIndex: 0; const ADelimiter: Char = US): string; SizeInt =
Description Get the path from the level correspondent to the index to the last level. Exemple: BrookGetPathLevels(/a/b/c/, 1) = b/c/.
BrookMatchMethod
Declaration function BrookMatchMethod(const ABrookMethod: AMethod: string): Boolean; TBrookRequestMethod; const
BrookDeleteFiles
Declaration procedure BrookDeleteFiles(APath: string; const ABeforeOf: TDateTime; const ASkippedFile: TFileName = ES; const AContains: string = ES); Description Deletes les according to their creation dates and le names.
BrookFileDate
Declaration function BrookFileDate(const AFileName: Description Get the datetime of a le. TFileName): TDateTime;
162
BrookFileSetDate
Declaration function BrookFileSetDate(const AFileName: TDateTime): LongInt; Description Set the datetime of a le. TFileName; const ADateTime:
BrookJSONCopy
Declaration procedure BrookJSONCopy(ASrc, ADest: TJSONObject); Description Copy the content of a JSON Object to another.
BrookDumpStack
Declaration function BrookDumpStack(const AEOL: ShortString = BR): string; Description Writes a backtrace of the current exception.
BrookExcludeHTTPPathDelimiter
Declaration function BrookExcludeHTTPPathDelimiter(const AUrl: Description Ensures URL ends with delimiter. string): string;
24.6
Types
TBrookArrayOfString
Declaration TBrookArrayOfString = array of string; Description Denes a array of strings.
TBrookRequestMethod
Declaration TBrookRequestMethod = (...); Description Denes an enumerator to represent the HTTP request methods. Values rmUnknown rmAll rmGet rmPost rmPut rmDelete rmHead rmOptions rmTrace 163
24.7
Variables
BrookSettings
Declaration BrookSettings: TBrookSettings = ( Mapped: False; Charset: BROOK HTTP CHARSET UTF 8; ContentType: BROOK HTTP CONTENT TYPE TEXT HTML; Language: BROOK DEFAULT LANGUAGE; Page404: BROOK HTTP RESPONSE TEMPLATE NOT FOUND; Page404File: ES; Page500: BROOK HTTP RESPONSE TEMPLATE INTERNAL SERVER ERROR; Page500File: ES; DirectoryForUploads: ES; DeleteUploadedFiles: False; KeepUploadedNames: True; AcceptsJSONContent: False; Configuration: ES; RootUrl: ES; Port: OnError: nil; ); Description Global variable to store Brook settings.
0;
164