sunlabs.brazil.handler

Class DeferredHandler

public class DeferredHandler extends Object implements Handler

Wrap another handler, deferring its initialization until request time. This allows handlers to be configured, but not initialized until a first use is attempted.

Normally, when a handler's class is first resolved, if any of the dependent classes are not available, an error will occur, terminating the server. Using this handler, other handlers can be conditionally configured based on the availability of other specified classes at run time.

NOTE: This functionallity should be integrated into the ChainHandler, eliminating the need for this one.

Request Properties

handler
The token representing the handler to conditionally configure. This is used as the handler's prefix
requires
The names of classes required to be resolvable before configuring the handler
[handler].prefix
Used to trigger the configuration
[handler].class
The name of the handler class.
Method Summary
booleaninit(Server server, String prefix)
Remember the server for deferred initialization.
booleanrespond(Request request)
Dispatch to the handler, installing it if needed

Method Detail

init

public boolean init(Server server, String prefix)
Remember the server for deferred initialization.

respond

public boolean respond(Request request)
Dispatch to the handler, installing it if needed