| | |
|
|
|
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:

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:

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):

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:

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:

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:

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:

A sample listing of debug files:

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

(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:

|
|
r17 - 17 Dec 2007 - 17:53:51 - ngawor
|
|
|
| | |