Routing Adapter

Adapter that performs mapping between request URL and business action using http-request-router (external site) . By using this adapter, mapping of URL and business action can be easily defined when building Web application or RESTful web service.

Module list

<!-- Routing adapter -->


Tests are conducted using http-request-router version 0.1.1. When changing the version, test in the project to confirm that there are no problems.

Configuration for using the routing adapter

The procedure for using this adapter is shown below.

Configure the dispatch handler

Configure RoutesMapping as the dispatch handler at the end of the handler queue.

The configuration example shown below.

  • The component name should be packageMapping .
  • Configure the package in which the action class is stored in basePackage attribute. (If the action class is stored in multiple packages, configure a common parent package.)
  • Configure RoutesMapping in the initialization list.
<component name="packageMapping" class="nablarch.integration.router.RoutesMapping">
  <property name="basePackage" value="sample.web.action" />

<component name="webFrontController" class="nablarch.fw.web.servlet.WebFrontController">
  <property name="handlerQueue">
      <!-- Other handlers are omitted -->
      <component-ref name="packageMapping" />

<component name="initializer"
  <property name="initializeList">
      <!-- Other initialization processes are omitted -->
      <component-ref name="packageMapping"/>

Create a route definition file

Creates routes.xml directly under the class path and configures the configurations to map the specified URL and business action.

For the configuration method to the route definition file, see Library README document (external site) .

Automatically map business actions and URLs

Business action and URL can be automatically mapped by using parameters such as :controller and :action in the path attribute of match tag in the route definition file.


This feature is not available when using JBoss or WildFly as the application server. Define the mapping between business action and URL individually using get tag, etc.


Using this function together with individual definition of mapping using get tag, etc. is not recommended. This is because of the difficultly in reading how the business action and URL are mapped from the route definition file when used together.

To enable this function, create in the router directory net/unit8/http/router created directly under the class path, and configure the values as follows.


An example of setting and mapping to the route definition file is shown below.

Route definition file
  <match path="/action/:controller/:action" />
Example of mapping URL to business action
Business action URL
PersonAction#index /action/person/index
PersonAction#search /action/person/search
LoginAction#index /action/login/index