|
Daraja HTTP Framework 3.2.1-SNAPSHOT
HTTP server framework for Object Pascal
|
A base class which can be subclassed to create a HTTP component for a Web site. More...
Public Member Functions | |
| TdjWebComponent () | |
| ~TdjWebComponent () | |
| 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. | |
| Init () | |
| A convenience method which can be overridden so that there is no need to call inherited Init(config). | |
| Init (const IWebComponentConfig Config) | |
| Called by the container on startup. | |
| Service (TdjServerContext Context, TdjRequest Request, TdjResponse Response) | |
| Handle a HTTP request. | |
Public Attributes | |
| IWebComponentConfig | Config |
Protected Member Functions | |
| OnDelete (TdjRequest Request, TdjResponse Response) | |
| Called by the server 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. | |
| TDateTime | OnGetLastModified (TdjRequest Request) |
| Returns the time the WebComponent object was last modified. | |
| 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. | |
| OnPatch (TdjRequest Request, TdjResponse Response) | |
| Called by the server to handle a PATCH request. | |
| OnPost (TdjRequest Request, TdjResponse Response) | |
| Called by the server to handle a POST request. | |
| OnPut (TdjRequest Request, TdjResponse Response) | |
| Called by the server to handle a PUT request. | |
| OnTrace (TdjRequest Request, TdjResponse Response) | |
| Called by the server to handle a TRACE request. | |
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:
| TdjWebComponent::TdjWebComponent | ( | ) |
References TdjWebComponent().
Referenced by TdjWebComponent(), ~TdjWebComponent(), OnGetLastModified(), OnPatch(), OnPut(), and Service().
| TdjWebComponent::~TdjWebComponent | ( | ) |
References TdjWebComponent().
|
inherited |
Get or create a HTTP session.
| Context | HTTP server context |
| Request | HTTP request |
| Response | HTTP response |
| Create | if True, create a session if no one exists |
|
inherited |
Returns a IWebComponentConfig object, which contains initialization parameters for this component.
| EWebComponentException | if the method is called before the component has been initialized. |
Implements IWebComponent.
|
inherited |
A convenience method which can be overridden so that there is no need to call inherited Init(config).
References TdjGenericWebComponent().
|
inherited |
Called by the container on startup.
| Config | the configuration |
| EWebComponentException | if initialization failed |
Implements IWebComponent.
References Init().
Referenced by Init().
|
protected |
Called by the server to handle a DELETE request.
| Request | The HTTP request to process |
| Response | The HTTP response to fill |
| EWebComponentException | if an exception occurs |
References OnGet().
|
protected |
Called by the server (via the service method) to allow a component to handle a GET request.
References OnHead().
Referenced by OnDelete().
|
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.
| Request | HTTP request |
References TdjWebComponent().
|
protected |
Called by the server (via the service method) to allow a component to handle a HEAD request.
The default implementation runs the same code path as a GET request, including the OnGetLastModified conditional handling, and the response body is suppressed. A component which overrides OnGet therefore answers HEAD requests with the GET headers and no content. If OnGet is not overridden either, the response is 405 Method Not Allowed.
| Request | The HTTP request to process |
| Response | The HTTP response to fill |
| EWebComponentException | if an exception occurs |
References OnPut().
Referenced by OnGet().
|
protected |
Called by the server (via the service method) to allow a component to handle a OPTIONS request.
References OnTrace().
|
protected |
Called by the server to handle a PATCH request.
| Request | The HTTP request to process |
| Response | The HTTP response to fill |
| EWebComponentException | if an exception occurs |
References TdjWebComponent().
|
protected |
Called by the server to handle a POST request.
| Request | The HTTP request to process |
| Response | The HTTP response to fill |
| EWebComponentException | if an exception occurs |
|
protected |
Called by the server to handle a PUT request.
| Request | The HTTP request to process |
| Response | The HTTP response to fill |
| EWebComponentException | if an exception occurs |
References TdjWebComponent(), and Service().
Referenced by OnHead().
|
protected |
Called by the server to handle a TRACE request.
| Request | The HTTP request to process |
| Response | The HTTP response to fill |
| EWebComponentException | if an exception occurs |
Referenced by OnOptions().
| TdjWebComponent::Service | ( | TdjServerContext | Context, |
| TdjRequest | Request, | ||
| TdjResponse | Response ) |
Handle a HTTP request.
The status code of the response always should be set for a component that throws or sends an error.
| Context | HTTP server context |
| Request | HTTP request |
| Response | HTTP response |
| EWebComponentException | if an exception occurs that interferes with the component's normal operation |
Implements IWebComponent.
References TdjWebComponent().
Referenced by OnPut().
|
inherited |