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

 

Developer Web tools

The zero.webtools package provides a set of useful utility functions for Zero application developers to use when building applications. The webtools module is included, by default, when you create a Zero application.

You should remove the webtools package before deploying your application into a production setting. This is done by removing the entry from your application's config/ivy.xml file.

Application default index page

Default URL: http://localhost:8080/

When you create a new Zero application, you will notice that the public folder of your application is initially empty. However, if you issue a request such as http://localhost:8080/ you will see an index page returned. This index page is provided by the webtools module. To override the index page, simply create an index page (for example index.html, index.groovy, index.gt, or index.php) in your application and it will be invoked instead of the one provided by this module. The default index page looks something like this:

zero-webtools-index-page.jpg

Request data viewer

Default URL: http://localhost:8080/zero/webtools/snoop.gt

When building a Web application, it is often useful to see the value of some of the key attributes available to your application, such as headers, cookies, and parameters. Webtools provides this through the request data viewer. Simply go to the URL /zero/webtools/snoop.gt in your application (for example http://localhost:8080/zero/webtools/snoop.gt) and you will get a response that is something like this:

zero-webtools-snoop.jpg

Developer-centric default error page

As a developer, having errors is very common during the construction of your application. When your application is deployed in a production setting, you want simple error pages displayed that are not full of technical details, something that the end user might actually understand. But during development, you want as much detail as possible. Webtools provides a replacement for the Zero default error page that gives you the full stack information for an error. When you remove webtools from your ivy.xml file, the default error page will revert to the simpler, end user optimized page. Of course, if you provide error pages in your application itself, they always take precedence. The developer centric error page will look something like this (notice that all of the stack trace sections are collapsible and the root exception is shown at the top):

zero-webtools-error-default.jpg

Specialized Groovy compile error page

Because Groovy scripts (.groovy and .gt) are a key component of Project Zero and Groovy is run dynamically, compilation errors at runtime can be a common event in Project Zero. To help you debug those errors, Webtools provides a specialized error page for Groovy compilation errors. It shows you the errors and the source code, with highlighted lines where the error occurred. This page is displayed automatically whenever a Groovy script has an error. Of course, when webtools is removed from your application dependencies, this page is not displayed and the simple, generic error page takes its place. The compile error page looks something like this:

zero-webtools-error-compile.jpg

Web based administration of file-based user service registry

Default URL: http://localhost:8080/zero/webtools/user

Webtools includes a Web-based administration console for creating, updating, and deleting users in a file-based user registry. Although a file-based user registry is suggested only for testing purposes, it can be an aid for rapid prototyping. The Web-based administration page looks something like this:

zero-web-based-admin-user-service.jpg

Command-line and Eclipse interfaces are also available for administering the UserService. Please refer to File Based User Service in the Developer's Guide.

Virtualized-directory browser

Default URL: http://localhost:8080/zero/webtools/browser.gt

The virtualized-directory browser is useful for viewing the collective set of files in your application's virtualized directories and distinguishing the source of those files (shown in parentheses next to the file name).

The virtualized directory browser page looks something like this:

zero-virtualized-directory-browser.jpg

Debug console

Default URL: http://localhost:8080/zero/webtools/debug.groovy

The debug console allows you to enable and disable debugging per user session and view logs individually for each request as well as an event tree for each request representing events, handlers, and condition and instance data. If you have request logging enabled, you can also use the debug console to view request logs. In order to change the level of detail logged by the debug logs adjust the .level in your application's logging.properties file.

The debug console page:
debug.jpg

A sample listing of debug files:
Picture_2.png

Clicking on a request displays a tree of events, handlers, and condition and instance data as well as any data logged for that request:
Picture_3.png

(On Firefox only) Clicking on an event or handler takes you to that portion of the log and highlights the portion where that event or handler is executing:
Picture_4.png

r17 - 17 Dec 2007 - 17:53:51 - ngawor
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site