Sign in Join
FPDoc Onlineexperiment

fpHTTP unit

HTTP request handling for web servers

The fphttp unit provides the foundation for handling HTTP requests in web server applications. It implements content producers, web actions, and web modules for processing HTTP requests and generating responses.

The idea behind the web module and action architecture is that they process an URL of the following kind:

{BaseURL}/module/action/*

Where the appropriate module is determined by the http router and the correct action is selected by the module. The action's event handler will then be executed.

If your application requires a more flexible URL handling, you may want to register callbacks directly with the HTTP router. If you are looking to generate HTML, then the fpweb unit contains web modules that descend from TCustomHTTPModule but are geared towards generating HTML.

Classes and records

EFPHTTPErrorclassException for HTTP processing errors
EWebSessionErrorclassException for session-related errors
TCustomHTTPModuleclassBase class for HTTP modules
TCustomWebActionclassBase class for web actions
TCustomWebActionsclassCollection of web actions
THTTPContentProducerclassBase class for HTTP content production
TModuleFactoryclassFactory for managing HTTP modules
TModuleItemclassContainer for module registration information
TSessionFactoryclassFactory for managing user sessions
TSessionHTTPModuleclassHTTP module with session support

Procedures and functions

RegisterHTTPModuleprocedureRegisters an HTTP module with the factory
SessionFactoryfunctionReturns the global session factory instance

Types

TCustomHTTPModuleClasstypeClass reference for HTTP modules
TGetActionEventprocedure typeEvent for determining action names
TInitModuleEventprocedure typeEvent for module initialization
TOnModuleRequestprocedure typeEvent for module request handling
TSessionFactoryClasstypeClass reference for session factories
TSessionHTTPModuleClasstypeClass reference for session HTTP modules
TWebActionEventprocedure typeEvent handler for web action processing
TWebModuleKindenumerationWeb module creation modes

Constants

cCSRFVariableconstant

Resource strings

SErrInvActNoDefaultActionresource stringError message for invalid action without default
SErrNoDefaultActionresource stringError message for missing default action
SErrNoSessionFactoryClassresource stringError message for missing session factory class
SErrNoSessionOutsideRequestresource stringError message for session access outside request
SErrNoSuchActionresource stringError message for unknown action
SErrNosuchModuleresource stringError message for unknown module
SErrRequestNotHandledresource stringError message for unhandled request
SErrUnknownActionresource stringError message for unrecognized action

Variables

ModuleFactoryvariableGlobal HTTP module factory instance
SessionFactoryClassvariableClass reference for session factory

Uses

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.