{title:'Path Variables', updated:'9.0.0'}

The path can contain variables that get resolved to {@link oaj.http.annotation.Path @Path} parameters or access through the {@link oajr.RestRequest#getPathParams()} method.

##### Example:

| @Rest( | path="/myResource/{foo}/{bar}" | ) | public class MyResource extends BasicRestServlet { | | @RestPost("/{baz}") | public void String doX(@Path String foo, @Path int bar) { | ... | } | }

Variables can be used on either top-level or child resources and can be defined on multiple levels. Path variables resolved in parent resource paths are also available to the child resources.

All variables in the path must be specified or else the target will not resolve and a 404 will result.