Tricia Help
Last edited Oct 28, 2011
Tags: no tags assigned  

Class HandlerDispatcher

in package de.infoasset.platform.handler

Declaration
public class HandlerDispatcher
extends AbstractInitializable
Hierarchy
java.lang.Object
  extendsde.infoasset.platform.util.AbstractInitializable
      extendsde.infoasset.platform.handler.HandlerDispatcher
All Implemented Interfaces
  • de.infoasset.imf.blackbox.Configurable
  • de.infoasset.imf.blackbox.Initializable

URL Mapping

A dispatcher implements a mapping from a URL to an instance of Handler.

There are two different strategies (see getHandler(String, boolean)). For a given URL they are applied in that order:

  1. Convention-based mapping for static URLs, and
  2. regex-based mapping for dynamic meaningful URLs using HandlerPatterns.

Convention-based URL Mapping

Convention means here, that the Handler class name corresponds directly with the given path.

At first the path is translated into the class name of the Handler:

  1. All slashes in the path are translated into .
  2. the last part of the path gets a capital first letter and the Suffix Handler.
This results in the class name in the handler package de.infoasset.%PROJECT_NAME%.handler (see Plugin ).

Example:
The path document/edit translates to the class name de.infoasset.%PROJECT_NAME%.handler.document.EditHandler

Now the dispatcher tries to find a handler class in all plugins according to their inheritance hierarchy see Plugin. If one is found it is instantiated with the Loader and returned.

Field Summary

static String
URL_CHARACTERS

Constructor Summary

HandlerDispatcher()

Method Summary

Object
getHandler(String path, boolean warnOnError)
void
initNew()
static HandlerDispatcher
INSTANCE()
void
testGetClassName()

Field Detail

URL_CHARACTERS

public static final String URL_CHARACTERS

Constructor Detail

HandlerDispatcher

public HandlerDispatcher()

Method Detail

INSTANCE

public static HandlerDispatcher INSTANCE()

initNew

public void initNew()

getHandler

public Object getHandler(String path,
                         boolean warnOnError)

testGetClassName

public void testGetClassName()

0 Comments