Class TRALResponse

Unit

Declaration

type TRALResponse = class(TRALHTTPHeaderInfo)

Description

Base class for everything related to data response

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TObject); override;
Public destructor Destroy; override;
Public function AddBody(const AText: StringRAL; const AContextType: StringRAL = rctTEXTPLAIN): TRALResponse; reintroduce;
Public function AddCookie(const AName: StringRAL; const AValue: StringRAL): TRALResponse; reintroduce;
Public function AddField(const AName: StringRAL; const AValue: StringRAL): TRALResponse; reintroduce;
Public function AddFile(AStream: TStream; const AFileName: StringRAL = ''): TRALResponse; reintroduce; overload;
Public function AddFile(const AFileName: StringRAL): TRALResponse; reintroduce; overload;
Public function AddHeader(const AName: StringRAL; const AValue: StringRAL): TRALResponse; reintroduce;
Public function GetParamsCookiesText(ADateTime: TDateTime; AHeader: StringRAL = 'Set-Cookie: ') : StringRAL;
Public function GetResponseEncStream(const AEncode: boolean = true): TStream; virtual; abstract;
Public function GetResponseEncText(const AEncode: boolean = true): StringRAL; virtual; abstract;
Protected function GetResponseStream: TStream;
Protected function GetResponseText: StringRAL;
Public procedure Answer(const AFileName: StringRAL; const DispositionInline: boolean = true); overload;
Public procedure Answer(AStatusCode: IntegerRAL); overload;
Public procedure Answer(AStatusCode: IntegerRAL; const AMessage: StringRAL; const AContentType: StringRAL = rctAPPLICATIONJSON); overload;
Public procedure Answer(AStatusCode: IntegerRAL; const AStream: TStream; const AContentType: StringRAL = rctAPPLICATIONJSON); overload;
Public procedure Clear; override;
Public procedure GetParamsCookies(ADest: TStringList; ADateTime: TDateTime);
Protected procedure SetResponseStream(const AValue: TStream); virtual; abstract;
Protected procedure SetResponseText(const AValue: StringRAL); virtual; abstract;

Properties

Published property ErrorCode: IntegerRAL read FErrorCode write FErrorCode;
Public property ResponseStream: TStream read GetResponseStream write SetResponseStream;
Public property ResponseText: StringRAL read GetResponseText write SetResponseText;
Published property StatusCode: IntegerRAL read FStatusCode write FStatusCode;

Description

Methods

Public constructor Create(AOwner: TObject); override;
 
Public destructor Destroy; override;
 
Public function AddBody(const AText: StringRAL; const AContextType: StringRAL = rctTEXTPLAIN): TRALResponse; reintroduce;

Append an UTF8 String to the response

Public function AddCookie(const AName: StringRAL; const AValue: StringRAL): TRALResponse; reintroduce;

Append a name:value cookie to the response

Public function AddField(const AName: StringRAL; const AValue: StringRAL): TRALResponse; reintroduce;

Append a custom param of type "Field" to the response

Public function AddFile(AStream: TStream; const AFileName: StringRAL = ''): TRALResponse; reintroduce; overload;

Append a file to the response from given AStream

Public function AddFile(const AFileName: StringRAL): TRALResponse; reintroduce; overload;

Loads and append a file to the response from given AFileName

Public function AddHeader(const AName: StringRAL; const AValue: StringRAL): TRALResponse; reintroduce;

Append a name:value param to the header of the response

Public function GetParamsCookiesText(ADateTime: TDateTime; AHeader: StringRAL = 'Set-Cookie: ') : StringRAL;

Returns an UTF8 String with RALParams Cookies' Headers

Public function GetResponseEncStream(const AEncode: boolean = true): TStream; virtual; abstract;

Returns the response in TStream format

Public function GetResponseEncText(const AEncode: boolean = true): StringRAL; virtual; abstract;

Returns the response in UTF8String format

Protected function GetResponseStream: TStream;

Returns the response in TStream format

Protected function GetResponseText: StringRAL;

Returns the response in UTF8String format

Public procedure Answer(const AFileName: StringRAL; const DispositionInline: boolean = true); overload;

Loads and set a file to the response with the given AFileName and sets the disposition to inline by default.

Public procedure Answer(AStatusCode: IntegerRAL); overload;

Sets the response with the given status code

Public procedure Answer(AStatusCode: IntegerRAL; const AMessage: StringRAL; const AContentType: StringRAL = rctAPPLICATIONJSON); overload;

Sets the response with the given status code, UTF8 String and Content-Type

Public procedure Answer(AStatusCode: IntegerRAL; const AStream: TStream; const AContentType: StringRAL = rctAPPLICATIONJSON); overload;

Sets the response with the given status code, Data Stream and Content-Type

Public procedure Clear; override;

Empties out the Response and sets default values

Public procedure GetParamsCookies(ADest: TStringList; ADateTime: TDateTime);

Fills the 'ADest' Strings with RALParams Cookies' Headers

Protected procedure SetResponseStream(const AValue: TStream); virtual; abstract;

Assign a Stream into the Response

Protected procedure SetResponseText(const AValue: StringRAL); virtual; abstract;

Assign an UTF8String into the Response

Properties

Published property ErrorCode: IntegerRAL read FErrorCode write FErrorCode;

TCP Client Connection Error

Public property ResponseStream: TStream read GetResponseStream write SetResponseStream;
 
Public property ResponseText: StringRAL read GetResponseText write SetResponseText;
 
Published property StatusCode: IntegerRAL read FStatusCode write FStatusCode;

HTTP StatusCode



GitHub Repository
Generated by PasDoc 0.16.0.