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

 

Configuring protocols

Requests made using the Connection API have a collection of protocol configuration properties associated with them which will eventually be used to send the request to the resource.

Each protocol implementation defines the protocol configuration it supports or requires. For more information about the protocols implementations and their configuration, see Protocol reference.

Protocol configuration and selection processing

Protocol configuration can be associated with a request in a number of ways:

  1. An application can use Connection.setProtocolConfiguration() to specify protocol configuration before sending the request.
  2. Connection handlers configured for the destination can set or update the protocol configuration.
  3. The final destination configuration may contain a connection configuration which sets or updates the protocol configuration.
  4. Once the protocol name has been finalized, any default configuration for the named protocol will be applied to the request.

When the connection infrastructure has executed any connection handlers and is ready to send the request, the following rules determine the name of the protocol that will be used.

  • If the request explicitly specifies a protocol configuration (/connection/request/protocol/_name) then the protocol name is selected.
  • Otherwise, if the target resource (/connection/request/target) is a valid URL then the protocol name is assumed to be the URL scheme name.
    • Note that mailto: URLs are mapped to the smtp protocol.
  • Otherwise, the protocol name is set to unresolved.

Once the protocol name has been finalized and any default configuration applied to the request, the connection infrastructure looks for a appropriate protocol implementation (or Transport) with which to send the request.

Connection configuration for a destination

A destination configuration can include a connection configuration to specify the protocol and configuration that should be used. A connection configuration overrides any similar configuration that may have been set by the application or a connection handler.

The following is a simple example specifies the HTTPS configuration which should be used when sending requests to URLs matching the wild card name value. For more information about destination configuration and an overview of destination processing, see Configuring destinations.

/config/connection/destinations += [{
        "name" : "https://www.projectzero.org/*",
        "connection" : {
                "protocol" : "https",
                "config" : { "httpsConfig" : "myHttpsConfig" }
        }
}]

A connection configuration can contain the following properties:

Property Associated request context key Description
target /connection/request/target Target resource name
operation /connection/request/operation Operation name
protocol /connection/request/protocol/_name Name of protocol to be invoked
config /connection/request/protocol/* Protocol configuration properties (requires protocol to be specified)

Specifying one of these connection properties sets the associated request context key, overriding any value that may have been set by the application or a connection handler. In addition, if the value specified by protocol does not match /connection/request/protocol/_name then all values previously set under /connection/request/protocol/* will be deleted; that is changing the name of the protocol destroys any previous protocol configuration.

Note that using the target property replaces the target resource name including any URL parameters it may have included.

For more information about the configuration properties supported by each protocol implementation, see Protocol reference.

Specifying default protocol configuration

In addition to specifying protocol configuration for individual destinations, it is possible to specify default protocol configuration properties. These will be applied to all requests using the protocol but do not yet have a value for the property.

Default protocol configuration properties are specified under the /config/connection/defaults/xxx key, where xxx is the protocol name.

For example, the following extract specifies the default hostname property for the smtp protocol. If a request using the smtp protocol does not have a /connection/request/protocol/hostname value when the protocol implementation is about to be invoked, then the connection infrastructure will give it the value specified by /config/connection/defaults/smtp/hostname.

/config/connection/defaults/smtp/hostname = "smtp.yourdomain.com"

r17 - 07 Feb 2008 - 20:01:45 - todkap
Syndicate this site RSS ATOM
Copyright 2007 © IBM Corporation | Privacy | Terms of Use | About this site