Overview

This plugin provides the default implementation of the Router interface, a set of classes to help creating Routes and manipulating them and is one of the most important components of a Spincast application.

Make sure you read the section dedicated to Routing for more information.

Installation

If you use the spincast-default artifact and the standard Bootstrapper, this plugin is already installed by default so you have nothing to do!

If you start from scratch, using the spincast-core artifact, you can use the plugin by :

1. Adding this Maven artifact to your project:

<dependency>
    <groupId>org.spincast</groupId>
    <artifactId>spincast-plugins-routing</artifactId>
    <version>2.2.0</version>
</dependency>

2. Installing the provided SpincastRoutingPluginModule module to your Guice context.

Plugin class

The class implementing the SpincastPlugin interface is SpincastRoutingPlugin.

Suggested add-on

Example :

public void myRouteHandler(DefaultRequestContext context) {

    // Is the current Route a "Not found" one?
    boolean isNotFoundRoute = context.routing().isNotFoundRoute();
    
    //...
}

This add-on is already installed by default on the Request Context type.

Javadoc

Configuration

You can bind a SpincastRouterConfig implementation to tweak the default configurations used by the components this plugin provides. By default, the SpincastRouterConfigDefault class is used as the implementation.