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

 

Virtualized directories

Project Zero provides seamless integration of script directories across an application and its dependencies, while maintaining each as separate entities. For example, while processing a request for GET /index.html, Project Zero searches for a file public/index.html in the application directory, then within each resolved dependency. The first occurrence of the file is served. Project Zero applications run as if the contents of the public directories, from application to dependencies, are merged with a first-one-wins precedence.

This notion of a virtualized directory describes all the script directories, including public, app/errors, app/resources, app/scripts, and app/views.

Working example

In this example, MyApplication is a Project Zero application that depends on the extension modules acme.A and acme.B, as shown in this excerpt from the following config/ivy.xml file within MyApplication:

    <dependencies>
      <dependency org="acme" name="acme.A" rev="1.0.0+"/> 
      <dependency org="acme" name="acme.B" rev="1.0.0+"/> 
      <dependency org="zero" name="zero.core" rev="1.0.0+"/> 
    </dependencies>

In this example, acme.A depends on extension modules acme.A1 and acme.A2, as shown in the following config/ivy.xml file within acme.A:

    <dependencies>
      <dependency org="acme" name="acme.A1" rev="1.0.0+"/> 
      <dependency org="acme" name="acme.A2" rev="1.0.0+"/> 
    </dependencies>

Also, acme.B depends on acme.B1 and acme.B2 as shown in the following example:

    <dependencies>
      <dependency org="acme" name="acme.B1" rev="1.0.0+"/> 
      <dependency org="acme" name="acme.B2" rev="1.0.0+"/> 
    </dependencies>

These dependencies can be summarized in the following way:

MyApplication -> acme.A -> acme.A1
                        -> acme.A2
              -> acme.B -> acme.B1
                        -> acme.B2

Search order

Searches through virtual directories are ordered by application first, and then breadth-first through the dependencies (in the order they appear in ivy.xml files). For this example, the search order is:

  1. MyApplication
  2. acme.A
  3. acme.B
  4. acme.A1
  5. acme.A2
  6. acme.B1
  7. acme.B2

Example file layout

The example file layout uses the notation ${MyApplication} to represent the root directory of MyApplication:

${/config/dependencies/MyApplication}
+ /public
  + index.html

${/config/dependencies/acme.B}
+ /public
  + index.gt
  + HelloWorld.groovy

${/config/dependencies/acme.A1}
+ /public
  + HelloWorld.groovy

Results

Based on the search order, requests are served as the following table shows:

Request Associated file
GET /HelloWorld.groovy ${/config/dependencies/acme.B}/public/HelloWorld.groovy
GET /index.html ${/config/dependencies/MyApplication}/public/index.html

Default files

A default file is the file processed on a request for a directory, such as GET /. With default configuration, the default files are a list that is searched in the following order: index.groovy, index.gt, then index.html.

Searches for default files are performed within each directory, rather than across directories. For the above example, the search for a default file for GET / would be as follows:

  1. ${/config/dependencies/MyApplication}/public/index.groovy
  2. ${/config/dependencies/MyApplication}/public/index.gt
  3. ${/config/dependencies/MyApplication}/public/index.html
  4. ${/config/dependencies/acme.A}/public/index.groovy
  5. ${/config/dependencies/acme.A}/public/index.gt
  6. ${/config/dependencies/acme.A}/public/index.html
  7. ...


HELP Advanced The search order for default files is specified by a List stored in the global context at /config/fileserver/searchOrder. Elements of that list are suffices, that are appended to the base file name "index".

r8 - 04 Dec 2007 - 21:12:06 - ngawor
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site