Daraja HTTP Framework 2.8
HTTP server framework for Object Pascal
Loading...
Searching...
No Matches
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
ContextHTTP server context
RequestHTTP request
ResponseHTTP response
Createif 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
EWebComponentExceptionif 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
Configthe configuration
Exceptions
EWebComponentExceptionif 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
ContextHTTP server context
RequestHTTP request
ResponseHTTP response
Exceptions
EWebComponentExceptionif 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().