Daraja HTTP Framework 3.0-MS1 HTTP server framework for Object Pascal

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
TdjWebComponent Class Reference

A base class which can be subclassed to create a HTTP component for a Web site. More...

Inheritance diagram for TdjWebComponent:

## Public Member Functions
| Service (TdjServerContext Context, TdjRequest Request, TdjResponse Response)
| Dispatches client requests to the protected service method.
Public Member Functions inherited from TdjGenericWebComponent
| TdjGenericWebComponent ()
| Constructor.
| ~TdjGenericWebComponent ()
| Destructor.
| Init (const IWebComponentConfig Config)
| Called by the container on startup.
TIdHTTPSession | GetSession (TdjServerContext Context, TdjRequest Request, TdjResponse Response, const Boolean Create=True)
| Get or create a HTTP session.
IWebComponentConfig | GetWebComponentConfig ()
| Returns a IWebComponentConfig object, which contains initialization parameters for this component.

## Protected Member Functions
| OnDelete (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a DELETE request.
| OnGet (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a GET request.
| OnHead (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a HEAD request.
| OnOptions (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a OPTIONS request.
| OnPost (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a POST request.
| OnPut (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a PUT request.
| OnTrace (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a TRACE request.
| OnPatch (TdjRequest Request, TdjResponse Response)
| Called by the server (via the service method) to allow a component to handle a PATCH request.
TDateTime | OnGetLastModified (TdjRequest Request)
| Returns the time the WebComponent object was last modified.
Protected Member Functions inherited from TdjGenericWebComponent
| Service (TdjServerContext Context, TdjRequest Request, TdjResponse Response)
| Handle a HTTP request.

## Additional Inherited Members
Public Attributes inherited from TdjGenericWebComponent
IWebComponentConfig | Config

## Detailed Description

A base class which can be subclassed to create a HTTP component for a Web site.

A subclass of TdjWebComponent must override at least one method, usually one of these:

- OnGet, if the web component supports HTTP GET requests
- OnPost, for HTTP POST requests
- OnPut, for HTTP PUT requests
- OnDelete, for HTTP DELETE requests

## Member Function Documentation

## ◆ OnGetLastModified()

TDateTime TdjWebComponent::OnGetLastModified | ( | TdjRequest | Request | ) |
| protected

Returns the time the WebComponent object was last modified.

If the time is unknown, this method returns 0 (the default).

WebComponents that support HTTP GET requests and can quickly determine their last modification time should override this method. This makes browser and proxy caches work more effectively, reducing the load on server and network resources.

Parameters

  Request | HTTP request

Returns
  the last modified timestamp

## ◆ OnPatch()

TdjWebComponent::OnPatch | ( | TdjRequest | Request,
|  | TdjResponse | Response )
| protected

Called by the server (via the service method) to allow a component to handle a PATCH request.

See also
  http://tools.ietf.org/html/rfc5789

## ◆ Service()

TdjWebComponent::Service | ( | TdjServerContext | Context,
|  | TdjRequest | Request,
|  | TdjResponse | Response )

Dispatches client requests to the protected service method.

Note
  a custom Web Component should not override this method.

Parameters

  Context | HTTP server context
  Request | HTTP request
  Response | HTTP response

Exceptions

  EWebComponentException | if an exception occurs that interferes with the component's normal operation