PHP Class AppserverIo\Appserver\ServletEngine\RequestHandler

Inheritance: extends Thread
Mostrar archivo Open project: appserver-io/appserver Class Usage Examples

Public Properties

Property Type Description
$applicationContext AppserverIo\Psr\Application\ApplicationInterface The prepared application context.
$requestContext AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The prepared request context.

Public Methods

Method Description
addError ( Error $error ) : void Append the passed error to the request handler's stack.
copyToHttpResponse ( AppserverIo\Psr\HttpMessage\ResponseInterface $httpResponse ) : void Copies the values from the request handler back to the passed HTTP response instance.
errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline ) : boolean PHP error handler implemenation that replaces the defaulf PHP error handling.
getApplicationContext ( ) : AppserverIo\Psr\Application\ApplicationInterface Returns the actual application instance thatrepresents the application context of this request.
getErrors ( ) : array Return's the array with the request handler's error stack.
getRequestContext ( ) : AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface Returns the actual servlet request instance that has been prepared to handle the actual request and represents the context of this request.
injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void Injects the application of the request to be handled
injectRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : void Inject the actual servlet request.
injectResponse ( AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void Inject the actual servlet response.
injectValves ( array $valves ) : void Injects the valves to be processed.
run ( ) : void The main method that handles the thread in a separate context.
shutdown ( ) : void Does shutdown logic for request handler if something went wrong and produces a fatal error for example.

Method Details

addError() public method

Append the passed error to the request handler's stack.
public addError ( Error $error ) : void
$error AppserverIo\Appserver\ServletEngine\Utils\Error The error to append
return void

copyToHttpResponse() public method

Copies the values from the request handler back to the passed HTTP response instance.
public copyToHttpResponse ( AppserverIo\Psr\HttpMessage\ResponseInterface $httpResponse ) : void
$httpResponse AppserverIo\Psr\HttpMessage\ResponseInterface A HTTP response object
return void

errorHandler() public method

As this method will NOT handle Fatal Errors with code E_ERROR or E_USER, so these have to be processed by the shutdown handler itself.
public errorHandler ( integer $errno, string $errstr, string $errfile, integer $errline ) : boolean
$errno integer The intern PHP error number
$errstr string The error message itself
$errfile string The file where the error occurs
$errline integer The line where the error occurs
return boolean Always return TRUE, because we want to disable default PHP error handling

getApplicationContext() public static method

Returns the actual application instance thatrepresents the application context of this request.
public static getApplicationContext ( ) : AppserverIo\Psr\Application\ApplicationInterface
return AppserverIo\Psr\Application\ApplicationInterface The actual application context

getErrors() public method

Return's the array with the request handler's error stack.
public getErrors ( ) : array
return array The stack with the request handler's errors

getRequestContext() public static method

Returns the actual servlet request instance that has been prepared to handle the actual request and represents the context of this request.
public static getRequestContext ( ) : AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface
return AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The prepared request context

injectApplication() public method

Injects the application of the request to be handled
public injectApplication ( AppserverIo\Psr\Application\ApplicationInterface $application ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance
return void

injectRequest() public method

Inject the actual servlet request.
public injectRequest ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest ) : void
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The actual request instance
return void

injectResponse() public method

Inject the actual servlet response.
public injectResponse ( AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The actual response instance
return void

injectValves() public method

Injects the valves to be processed.
public injectValves ( array $valves ) : void
$valves array The valves to process
return void

run() public method

The main method that handles the thread in a separate context.
public run ( ) : void
return void

shutdown() public method

Does shutdown logic for request handler if something went wrong and produces a fatal error for example.
public shutdown ( ) : void
return void

Property Details

$applicationContext public_oe static_oe property

The prepared application context.
public static ApplicationInterface,AppserverIo\Psr\Application $applicationContext
return AppserverIo\Psr\Application\ApplicationInterface

$requestContext public_oe static_oe property

The prepared request context.
public static HttpServletRequestInterface,AppserverIo\Psr\Servlet\Http $requestContext
return AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface