Allow endpoint @Selector to capture all paths

Update `@Selector` with a `match` attribute that can be used to select
all remaining path segments. An endpoint method like this:

	 select(@Selector(match = Match.ALL_REMAINING) String... selection)

Will now have all reaming path segments injected into the `selection`
parameter.

Closes gh-17743
This commit is contained in:
Phillip Webb
2019-07-31 12:33:59 +01:00
parent b8bda1c03d
commit 890ea153bf
10 changed files with 356 additions and 25 deletions

View File

@@ -577,7 +577,6 @@ endpoint.
[[production-ready-endpoints-custom-web-predicate-path]]
===== Path
The path of the predicate is determined by the ID of the endpoint and the base path of
web-exposed endpoints. The default base path is `/actuator`. For example, an endpoint with
the ID `sessions` will use `/actuator/sessions` as its path in the predicate.
@@ -585,13 +584,14 @@ the ID `sessions` will use `/actuator/sessions` as its path in the predicate.
The path can be further customized by annotating one or more parameters of the operation
method with `@Selector`. Such a parameter is added to the path predicate as a path
variable. The variable's value is passed into the operation method when the endpoint
operation is invoked.
operation is invoked. If you want to capture all remaining path elements, you can add
`@Selector(Match=ALL_REMAINING)` to the last parameter and make it a type that is
conversion compatible with a `String[]`.
[[production-ready-endpoints-custom-web-predicate-http-method]]
===== HTTP method
The HTTP method of the predicate is determined by the operation type, as shown in
the following table: