Skip to content

TResponse

HTTP response representation

Declaration

Source position: httpdefs.pp line 591

type

  TResponse = class(THTTPHeader)
  public
    constructor Create; overload;
    destructor destroy;
    procedure SendContent;
    procedure SendHeaders;
    procedure SendResponse;
    procedure StartServerEvents;
    procedure SendServerEvent;
    procedure EndServerEvents;
    procedure SendRedirect;
    function ToString : RTLString;
    procedure SetStatus;
    property Request: TRequest; {r}
    property Code: Integer; {rw}
    property CodeText: string; {rw}
    property Age: string; {rw}
    property Allow: string; {rw}
    property CacheControl: string; {rw}
    property ContentLocation: string; {rw}
    property ContentMD5: string; {rw}
    property ContentRange: string; {rw}
    property ETag: string; {rw}
    property ProxyAuthenticate: string; {rw}
    property RetryAfter: string; {rw}
    property FirstHeaderLine: string; {rw}
    property ContentStream: TStream; {rw}
    property Content: RawByteString; {rw}
    property Contents: TStrings; {rw}
    property HeadersSent: Boolean; {r}
    property ContentSent: Boolean; {r}
    property Cookies: TCookies; {r}
    property FreeContentStream: Boolean; {rw}
  end;

Description

TResponse represents an HTTP response sent back to a client. It extends THTTPHeader and provides methods to set status codes, headers, content, cookies, and send the response data.

Properties

Member Visibility Description
Age public Age header value indicating response age in seconds
Allow public Allow header value listing permitted HTTP methods
CacheControl public Cache-Control header value for caching directives
Code public HTTP response status code
CodeText public HTTP response status text
Content public Response body content as string
ContentLocation public Content-Location header value for alternate location
ContentMD5 public Content-MD5 header value with MD5 digest of content
ContentRange public Content-Range header value for partial content
Contents public String list containing response content lines
ContentSent read only public Indicates whether response content has been sent
ContentStream public Stream containing response body content
Cookies read only public Collection of HTTP cookies to send with response
ETag public ETag header value for entity tag validation
FirstHeaderLine public First line of HTTP response headers
FreeContentStream public Whether to automatically free the content stream
HeadersSent read only public Indicates whether response headers have been sent
ProxyAuthenticate public Proxy-Authenticate header value for proxy authentication
Request read only public Associated HTTP request object
RetryAfter public Retry-After header value indicating when to retry request
See all Properties

Methods

Member Visibility Description
Create public Creates an HTTP response instance
destroy public Destroys the HTTP response instance
EndServerEvents public Ends server-sent events mode
SendContent public Sends the response content to the client
SendHeaders public Sends the response headers to the client
SendRedirect public Sends a redirect response
SendResponse public Sends the complete HTTP response
SendServerEvent public Sends a server-sent event
SetStatus public Sets the HTTP status code and text
StartServerEvents public Starts server-sent events mode
ToString public Returns string representation of the response
See all Methods

See also

Name Description
TRequest HTTP request representation
THTTPHeader Base class for HTTP header management
TCookies Collection of HTTP cookies