A server event listener receive signals from the framework at various moments in the application lifecycle.

Methods

onClose (configuration:ServerConfiguration):Void

Application close event. Called before the ServerConfiguration object is closed.

Parameters:

configuration

The configuration that has been used throughout the application

onDispatch (urlMapping:URLMapping, requestInfo:RequestInfo):Void

Dispatch event. Called when the queried URL corresponds to a controller (the URL has been dispatched). The event is only triggered when the controller's "handleRequest" returns true.

Parameters:

urlMapping

The mapping that was matched

requestInfo

The request information

onDispatchInterrupted (urlMapping:URLMapping, requestInfo:RequestInfo):Void

Interrupted dispatch event. Called when the URL dispatcher manages to find the controller to call, but the controller's handleRequest method returns false.

Parameters:

urlMapping

The mapping that was matched

requestInfo

The request information

onError (exception:Exception):Void

Error event - called when the server encounters errors that are not covered by HTTP status codes.

Parameters:

exception

The exception that was thrown

onHTTPError (exception:HTTPException):Void

HTTP Error event. Called when the server encounters a HTTP error during dispatching or controller operations. Usually, these are 404 or 500 errors.

Parameters:

exception

The exception that was thrown

onStart (configuration:ServerConfiguration):Void

Application start event. Called after the ServerConfiguration is initialized.

Parameters:

configuration

The configuration that is used to start the application