RewindBehaviours - gtosto/struts2-arianna-plugin GitHub Wiki
The rewind behaviour is controlled by two parameters: the RewindMode and the used CrumbComparator.
The rewind mode instructs the plugin on how deal duplicated crumbs. What duplicated means depends by the comparator actually used (see below).
When the rewind mode is set to NEVER the plugin will never(1) rewind the bread crumbs and it will allow the bread crumbs trail to have duplicated crumbs.
When the rewind mode is set to AUTO duplicated crumbs are not allowed. If you invoke an action that would create a crumb that yields an already existing crumb, the plugin will rewind the crumbs trail to that crumb replacing the old crumb with the newest one.
For example if the current bread crumb is
Action1 > Action2 > Action3 > Action4
and the next invoked action creates a crumb that is equals (in the sense defined by the comparator) to the Action2 then the trail will be rewound to be
Action1 > Action2
As we have seen above the plugin use a given comparator to check for Crumbs equality.
Even if you can write your own custom comparator, the arianna plugin provides 3 ready-to-use comparators:
Name Comparator xyz.timedrain.arianna.plugin.NameComparator A comparator that surprisingly just check crumb's name for equality.
Action Comparator xyz.timedrain.arianna.plugin.ActionComparator This comparator checks the action identity, From its viewpoint two crumbs are equals when they have the same namespace, action name and method name only. It does't care about crumb name.
Request Comparator xyz.timedrain.arianna.plugin.RequestComparator This comparator besides to check for action identity (like the Action Comparator does) will also check request parameter equalities.
If none of the built-in comparator meets your needs, you can also write your own custom comparator.
Just implement the java.util.Comparator<Crumb> interface and write the desired logic.
For example
public class MyComparator implements Comparator<Crumb>
{
public int compare(Crumb c1, Crumb c2) {
// your custom logic
}
}Note Any crumb comparator implementation must provide a public no-args constructor.