Framework Skeleton: Setting STDERR XML

This user-defined file is a XML requirement of STDERR MVC API. Skeleton comes with a built-in version that uses following bindings:

API XML Tag Bound to Description
application>paths>controllers application/controllers Sets folder where STDERR controllers are searched
application>paths>views application/views Sets folder where views are searched
application>paths>reporters application/reporters Sets folder where error reporters are searched
application>paths>renderers application/renderers Sets folder where error view resolvers/renderers are searched
application HtmlRenderer
ViewLanguageRenderer
Adds ability of HTML response to be templated and errors to be displayed.
renderers HtmlRenderer
JsonRenderer
ViewLanguageRenderer
Adds HTML & JSON response abilities via STDERR MVC API renderers
reporters FileReporter
SyslogReporter
Binds STDERR MVC API reporters to Logging API
exceptions ErrorsController
SecurityPacketController
Registers policies for all exceptions known by framework and controllers to handle them

application

This tag is a requirement of STDERR MVC API, also used to setup View Language API templating. Documentation of STDERR structural requirements is already given HERE, so we will only concentrate in templating and error display specific additions.

Syntax:

<application templates_extension="{EXTENSION}" ...> <paths> <compilations>{COMPILATIONS}</compilations> <tags>{TAGS}</tags> ... </paths> </application>

Where:

Example:

<application templates_extension="html" auto_routing="0" default_page="index" default_format="html"> <paths> <controllers>application/views</controllers> <views>application/views</views> <tags>application/taglib</tags> <compilations>compilations</compilations> </paths> </application>

renderers

This tag is a requirement of STDERR MVC API to configure response on errors. Documentation of API structural requirements is already given HERE, so we will only concentrate in framework additions.

Developers are free to choose which solution fits their app best, or add their own for other content types!

reporters

This tag is a requirement of STDERR MVC API to configure reporting of errors. Documentation of API structural requirements is already given HERE, so we will only concentrate in framework additions. Framework builds a bridge between STDERR MVC API and Logging API through file LogReporter, which makes it possible to report via already existing loggers:

Developers can add their own reporters as long as they extend LogReporter and they are found in folder application/reporters.

exceptions

This tag is a requirement of STDERR MVC API used in routing exceptions to controllers and views. Documentation of API structural requirements is already given HERE, so we will only concentrate in framework additions.

In <exceptions> tag framework registers a global routing policy that applies whenever exception isn't routed specifically in its own <exception> tag. In most cases, however, framework needs to register individual <exception> policies for every exception it knows of (from skeleton itself or bounded apis). The end result is:

Class Error Type Controller View HTTP Status
all minus below (global routing) LOGICAL ErrorsController
Lucinda\Framework\SecurityPacket NONE SecurityPacketController
Lucinda\MVC\STDOUT\PathNotFoundException CLIENT 404 404 Not Found
Lucinda\MVC\STDOUT\MethodNotAllowedException CLIENT 405 405 Method Not Allowed
Lucinda\MVC\STDOUT\FileUploadException SERVER 400 400 Bad Request
Lucinda\MVC\STDERR\PHPException SYNTAX ErrorsController
Lucinda\WebSecurity\SessionHijackException CLIENT 400 400 Bad Request
Lucinda\WebSecurity\EncryptionException CLIENT 400 400 Bad Request
Lucinda\WebSecurity\TokenException CLIENT 400 400 Bad Request
Lucinda\SQL\ConnectionException SERVER ErrorsController
Lucinda\SQL\StatementException SYNTAX ErrorsController
Lucinda\NoSQL\ConnectionException SERVER ErrorsController
Lucinda\NoSQL\OperationFailedException SERVER ErrorsController
Lucinda\NoSQL\KeyNotFoundException SYNTAX ErrorsController
OAuth2\ServerException SERVER ErrorsController
Lucinda\Templating\ViewException SYNTAX ErrorsController

Developers can add their own exception routes there using syntax described HERE!

Notes:
1. When controllers are set, they take full responsibility in setting response, thus attributes "view" and "http_status" are left empty in respective <exception> tag.
2. Value of "view" attribute in <exceptions> or <exception> tags applies only for text/html response content type
3. Controllers and views will be located in folders set by application>paths>controllers and application>paths>views tags of stderr.xml


Share