Let’s look at some real-world examples for the most common ways to process (part of) the path:
Traversing the model graph
Additionally, objects can implement several interfaces to further control how Stapler processes URLs:
org.kohsuke.stapler.StaplerProxy allows delegating the processing of a URL to another object.
getFoo() returns an object
x that implements
StaplerProxy’s `getTarget() method, Stapler will call
x.getTarget() and continue using that to process the rest of the URL (
This has the highest priority among all possible URL processing options.
getTarget() may also return
this, for example to implement permission checks: No getters or views of
x will be available to anyone who doesn’t have the necessary permissions via URLs.
org.kohsuke.stapler.StaplerOverridable is an interface allowing designated objects to selectively override URL mappings.
If the designated override objects do not have a handler for the request, the host object (that implements
StaplerOverridable) will handle the request.
org.kohsuke.stapler.StaplerFallback allows delegating the processing of a URL to another object, similar to
StaplerProxy, but has the lowest priority among all possible URL processing options.
For more information on how Stapler binds (or staples) a Java Object Model to a URL hierarchy, see the Stapler Reference Documentation.