Broadcast on Broadcast off
The Documentation for Project Zero has moved. Please update your bookmarks to: http://www.projectzero.org/documentation/
Table of
Contents...
Hide

Project Zero Developer’s Guide

Concepts and components
Basic concepts overview
Event processing
Writing Java handlers
Writing Groovy handlers
Firing events
Global Context
Global Context reference
Application directory layout
Virtualized directories
Assemble
PHP
Features and configuration
Configuration
Debugging
Dependencies
Packaging
Application classpath
Logging and tracing
RESTful resources
RESTful documentation
File serving
Response rendering
Validators and validation
HTTP error handling
Calling a remote resource
Using the Connection API
Sending an email using EmailConnection
Configuring destinations
Configuring protocols
Configuring connection handlers
Creating a connection handler
Creating a custom protocol transport
Simple logging connection handlers
Protocol reference
Client programming with Dojo
Runtime options
Deployment modifications
HTTP configuration
SSL configuration
Proxy configuration
Extending the CLI
Security considerations
Authentication
OpenID authentication
Extending security
Security tokens
CSRF prevention support
Extending token support
Leveraging TAI
User service
File based user service
LDAP user service
Extending user service
Security Utilities
Leveraging XOREncoder
Extensions
Atom support
RSS support
JSON support
XMLEncoder
REST to SOAP extension
URIUtils
Developer Web tools
Database setup tools
Configuring data access
Common query patterns
Advanced query patterns
Update patterns
Local database transactions
Extending data access
Configuration vendor differences
PHP data access
Resource model
Configuring ZRM
Resource model declaration
Programmatic model API
HTTP REST API
A ZRM mini tutorial
Active content filtering support
Default filters
Custom filters
Runtime management
Management commands
Zero socket opener
Other extension modules
Amazon E-commerce service
Flickr service
WeatherZero forecast service
Wikipedia service
Reference
Zero command line interface
JavaDoc - Public API
JavaDoc - Public SPI
JavaDoc - All Classes

 

HTTP error handling

When problems occur on a Web site, error pages should be returned to the client. You can use the rendering capabilities to provide custom error pages.

Rendering error pages

To display an error page, use the following required steps:

  1. Set the status code: /request/status
  2. Set the value of /request/view to error.
  3. Invoke zero.core.views.ViewEngine.render()

request.status = 404
... // set any header values here
request.view = "error"
render()

Naming error pages

Error pages can be scripts, templates or HTML. You must place all error pages in your app/errors directory. An error page can represent a specific error code, the class of codes, or a default page for all error codes.

<appRoot>
+ app/
  + errors/
    - error404.groovy         error page for status code = 404
    - error5XX.gt             error page for any error code >= 500 and < 600
    - error.html              default error page for all error codes

For any error code, the following set of error pages are searched for location, in the following order:

  1. error<status code>.<extension>
  2. error<class of status code>.<extension>
  3. error.<extension>.

The extension is determined by the extension search order, which is stored in the global context at /config/fileserver/defaultExtensions.

Error pages from dependencies

If the error page cannot be found in your application, the dependencies of your application are also searched using virtualized directories.

zero.core provides a set of default error pages that the application can override.

zero.core.webtools provides a default error page. The default error page allows you to set a message, /request/error/message, and exception, /request/error/exception, to include in the resulting page.

r12 - 29 Jan 2008 - 19:57:49 - paynel
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site