Daraja Framework  1.2
HTTP server framework for Object Pascal
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. More...
 
TIdHTTPSession GetSession (TdjServerContext Context, TdjRequest Request, TdjResponse Response, const Boolean Create=True)
 Get or create a HTTP session. More...
 
IWebComponentConfig GetWebComponentConfig ()
 Returns a IWebComponentConfig object, which contains initialization parameters for this component. More...
 

Public Attributes

IWebComponentConfig Config
 

Protected Member Functions

 Service (TdjServerContext Context, TdjRequest Request, TdjResponse Response)
 Handle a HTTP request. More...
 

Detailed Description

Defines a generic Web Component.

Member Function Documentation

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
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.
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

Referenced by TdjWebComponentHolder::TdjWebComponentHolder().

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

IWebComponentConfig TdjGenericWebComponent::Config
See also
GetWebComponentConfig For reading