org.restlet.engine.component

## Class InternalRouter

- java.lang.Object
- - org.restlet.Restlet
  - - org.restlet.routing.Router
    - - org.restlet.engine.component.InternalRouter

All Implemented Interfaces:
  Uniform

    public class InternalRouter
    extends Router

Provides the behavior of the internal router of a Component. It overrides the default behavior of a classic Router.

Author:
  Thierry Boileau

### Field Summary

### Fields inherited from class org.restlet.routing.Router

`BEST, CUSTOM, FIRST, LAST, MODE_BEST_MATCH, MODE_CUSTOM, MODE_FIRST_MATCH, MODE_LAST_MATCH, MODE_NEXT_MATCH, MODE_RANDOM_MATCH, NEXT, RANDOM`

### Constructor Summary

Constructors
Constructor and Description
`InternalRouter(Context context)` Constructor.

### Method Summary

Methods
`Route` `attach(Restlet target)` Attaches a target Restlet to this router with an empty URI pattern.
`Route` `attach(java.lang.String uriPattern, Restlet target)` Attaches a target Restlet to this router based on a given URI pattern.
`Route` `attachDefault(Restlet defaultTarget)` Attaches a Restlet to this router as the default target to invoke when no route matches.
`Finder` `createFinder(java.lang.Class<?> targetClass)` Creates a new finder instance based on the "targetClass" property.
`protected Route` `createRoute(java.lang.String uriPattern, Restlet target, int matchingMode)` Creates a new route for the given URI pattern, target and matching mode.

### Methods inherited from class org.restlet.routing.Router

`attach, attach, attach, attach, attachDefault, createRoute, detach, detach, doHandle, getCustom, getDefaultMatchingMode, getDefaultMatchingQuery, getDefaultMatchQuery, getDefaultRoute, getFinderClass, getMatchingMode, getMaxAttempts, getNext, getRequiredScore, getRetryDelay, getRoutes, getRoutingMode, handle, logRoute, setDefaultMatchingMode, setDefaultMatchingQuery, setDefaultMatchQuery, setDefaultRoute, setFinderClass, setMaxAttempts, setRequiredScore, setRetryDelay, setRoutes, setRoutingMode, start, stop`

### Methods inherited from class org.restlet.Restlet

`finalize, getApplication, getAuthor, getContext, getDescription, getLogger, getName, getOwner, isStarted, isStopped, setAuthor, setContext, setDescription, setName, setOwner`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### InternalRouter

    public InternalRouter(Context context)

Constructor.

Parameters:
  `context` -

### Method Detail

#### createRoute

    protected Route createRoute(java.lang.String uriPattern,
                    Restlet target,
                    int matchingMode)

Description copied from class: `Router`
Creates a new route for the given URI pattern, target and matching mode. The route will match the URI query string depending on the result of `Router.getDefaultMatchingQuery()`.

Overrides:
  `createRoute` in class `Router`
Parameters:
  `uriPattern` - The URI pattern that must match the relative part of the resource URI.
  `target` - The target Restlet to attach.
  `matchingMode` - The matching mode.
Returns:
  The created route.

#### attach

    public Route attach(Restlet target)

Description copied from class: `Router`
Attaches a target Restlet to this router with an empty URI pattern. A new route using the matching mode returned by `Router.getMatchingMode(Restlet)` will be added routing to the target when any call is received.

Overrides:
  `attach` in class `Router`
Parameters:
  `target` - The target Restlet to attach.
Returns:
  The created route.

#### attach

    public Route attach(java.lang.String uriPattern,
               Restlet target)

Description copied from class: `Router`
Attaches a target Restlet to this router based on a given URI pattern. A new route using the matching mode returned by `Router.getMatchingMode(Restlet)` will be added routing to the target when calls with a URI matching the pattern will be received.

Overrides:
  `attach` in class `Router`
Parameters:
  `uriPattern` - The URI path template that must match the relative part of the resource URI.
  `target` - The target Restlet to attach.
Returns:
  The created route.

#### attachDefault

    public Route attachDefault(Restlet defaultTarget)

Description copied from class: `Router`
Attaches a Restlet to this router as the default target to invoke when no route matches. It actually sets a default route that scores all calls to 1.0.

Overrides:
  `attachDefault` in class `Router`
Parameters:
  `defaultTarget` - The Restlet to use as the default target.
Returns:
  The created route.

#### createFinder

    public Finder createFinder(java.lang.Class<?> targetClass)

Description copied from class: `Router`
Creates a new finder instance based on the "targetClass" property.

Overrides:
  `createFinder` in class `Router`
Parameters:
  `targetClass` - The target Resource class to attach.
Returns:
  The new finder instance.