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

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

Defines a generic Web Component. More...

Inheritance diagram for TdjGenericWebComponent:

## Public Member Functions
| 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.

## Public Attributes
IWebComponentConfig | Config

## Protected Member Functions
| Service (TdjServerContext Context, TdjRequest Request, TdjResponse Response)
| Handle a HTTP request.

## Detailed Description

Defines a generic Web Component.

## Member Function Documentation

## ◆ GetSession()

TIdHTTPSession TdjGenericWebComponent::GetSession | ( | TdjServerContext | Context,
|  | TdjRequest | Request,
|  | TdjResponse | Response,
|  | const Boolean | Create = True )

Get or create a HTTP session.

Note
  it requires the current TdjServerContext so calling it from one of the HTTP method handlers is not possible. It can be called from the Servive method.
  if the context was created with the Auto Session option, this method will always return a session independent of the Create parameter

Parameters

  Context | HTTP server context
  Request | HTTP request
  Response | HTTP response
  Create | if True, create a session if no one exists

Returns
  HTTP session

## ◆ GetWebComponentConfig()

IWebComponentConfig TdjGenericWebComponent::GetWebComponentConfig | ( |  | ) |

Returns a IWebComponentConfig object, which contains initialization parameters for this component.

Exceptions

  EWebComponentException | if the method is called before the component has been initialized.

## ◆ Init()

TdjGenericWebComponent::Init | ( | const IWebComponentConfig | Config | ) |

Called by the container on startup.

Note
  if this method is overridden, the overriding code must also call inherited Init.

Parameters

  Config | the configuration

Exceptions

  EWebComponentException | if initialization failed

References Config.

## ◆ Service()

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

Handle a HTTP request.

The status code of the response always should be set for a component that throws or sends an error.

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

## Member Data Documentation

## ◆ Config

IWebComponentConfig TdjGenericWebComponent::Config

See also
  GetWebComponentConfig For reading

Referenced by Init().