{#========================================== Spincast Routing plugin ==========================================#} {% extends "../../layout.html" %} {% block sectionClasses %}plugins hasBreadCrumb plugins-spincast-routing{% endblock %} {% block meta_title %}Plugins - Spincast Routing{% endblock %} {% block meta_description %}Routing related components.{% endblock %} {% block scripts %} {% endblock %} {% block body %}
The Spincast Routing plugin contains the Spincast Router, which is an implementation
of the Router interface and one
of the most important component of a Spincast application.
It also provides a set of classes to help creating Routes and manipulating them.
Finally, it provides a
RoutingRequestContextAddon
implementation, which is
a request context add-on giving your route handlers access to information about the current
routing process.
Make sure you read the section dedicated to Routing for more information.
If you use the spincast-default artifact, this plugin is already installed so
you have nothing more to do!
If you start from scratch using the spincast-core artifact, you can use the
plugin by adding this Maven artifact to your project:
<dependency>
<groupId>org.spincast</groupId>
<artifactId>spincast-plugins-routing</artifactId>
<version>{{spincast.spincastCurrrentVersion}}</version>
</dependency>
You then install the plugin's Guice module, by passing it to the Guice.createInjector(...) method:
Injector guice = Guice.createInjector(
new SpincastCoreGuiceModule(args),
new SpincastRoutingPluginGuiceModule(AppRequestContext.class, AppWebsocketContext.class)
// other modules...
);
... or by using the install(...) method from your custom Guice module:
public class AppModule extends SpincastCoreGuiceModule {
@Override
protected void configure() {
super.configure();
install(new SpincastRoutingPluginGuiceModule(getRequestContextType(),
getWebsocketContextType()));
// other modules...
}
// ...
}
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.