public interface PathBinder
Path binders are the basis of path based “routing” in Ratpack, in conjunction with Handlers.path(PathBinder, Handler)
.
It is not common to use or create a path binder directly.
Instead, methods such as Chain.path(String, Handler)
create a binder from a string specification (using parse(String, boolean)
).
See the section on path binding as part of the Chain documentation for more information.
Modifier and Type | Method and Description |
---|---|
Optional<PathBinding> |
bind(PathBinding parentBinding)
Attempts to bind in the context of the given parent binding.
|
static PathBinderBuilder |
builder()
Creates a new path binder builder.
|
static PathBinder |
of(boolean exhaustive,
Action<? super PathBinderBuilder> action)
Builds a path binder programmatically.
|
static PathBinder |
parse(String pathBindingSpec,
boolean exhaustive)
Creates a path binder by parsing the given path binding specification.
|
Optional<PathBinding> bind(PathBinding parentBinding)
A binder may use whatever strategy it desires to decider whether or not it wants to create a binding for the given path.
parentBinding
- the parent bindingstatic PathBinder parse(String pathBindingSpec, boolean exhaustive)
This method is used by methods such as Chain.path(String, Class)
.
See the section on path binding as part of the Chain documentation for the format of the string.
pathBindingSpec
- the path binding specification.exhaustive
- whether the binder must match the entire unbound path (false for a prefix match)static PathBinder of(boolean exhaustive, Action<? super PathBinderBuilder> action) throws Exception
exhaustive
- whether the binder must match the entire unbound path (false for a prefix match)action
- the binder definitionException
- any thrown by action
static PathBinderBuilder builder()