
templates.plugins.spincast-variables-addon.spincast-variables-addon.html Maven / Gradle / Ivy
Show all versions of spincast-website Show documentation
{% extends "../../layout.html" %}
{% block sectionClasses %}plugins hasBreadCrumb plugins-spincast-variables-addon{% endblock %}
{% block meta_title %}Plugins - Spincast Variables Addon{% endblock %}
{% block meta_description %}Spincast Variables Addon plugin{% endblock %}
{% block scripts %}
{% endblock %}
{% block body %}
Overview
This plugin provides an add-on
to allow a Route Handler
to set request scoped variables which will be available to other Route Handlers
.
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-variables-addon</artifactId>
<version>{{spincast.spincastCurrrentVersion}}</version>
</dependency>
2. Installing the provided SpincastVariablesPluginModule
module to your Guice context.
Plugin class
The class implementing the SpincastPlugin
interface is SpincastVariablesPlugin.
Suggested add-on
-
Name :
variables()
-
Component : VariablesRequestContextAddon
-
Usage : to allow a
Route Handler
to read and write
request scoped variables.
Example :
public void myHandler(AppRequestContext context) {
// Reads a request scoped variable
context.variables().get("someVariable");
// Adds a new request scoped variable
context.variables().set("newVariable", "some value");
//...
}
This add-on is already installed by default on the
Request Context type.
Javadoc
{% endblock %}