On Mon, 2002-06-10 at 13:29, Ray Zimmerman wrote:
> So how is everybody else handling URL mapping? Do others group this 
> kind of data together with fonts, colors, etc?  And where do you 
> define it?

As Perrin mentioned, OpenInteract does this by allowing individual
packages (distributable applications) to define the handlers they
support. A package does this by defining actions which at server startup
get collected into a data structure called the action table.

A single mod_perl handler catches all requests, looks up the URL in the
action table and dispatches the request to the appropriate handler. That
handler is free to pass on the request to other actions as well, since
every part of the system is able to lookup actions based on a key.

Entries in the action table can also be used as components --
displayable items that don't stand by themselves but contribute to a
full page. Examples include boxes, common search forms, dependent object
listings, etc.

Currently, here's what an action looks like, as found in the 'base_user'
package distibuted with OpenInteract:

$action = {
    'user'    => {
        'class'    => 'OpenInteract::Handler::User',
        'security' => 'no',
    },
    'newuser' => {
        'class'    => 'OpenInteract::Handler::NewUser',
        'error'    => [ 'OpenInteract::Error::User' ],
        'security' => 'no',
    },
};

All information is available through a lookup to the action table.

One of the modifications I'm working on now will allow you to add more
information to the action and have it available in an object that is
instantiated by the dispatcher which then tells the object to run
itself.

Chris
 
-- 
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.

Reply via email to