@Retention(value=RUNTIME) @Target(value={METHOD,TYPE}) public @interface Path
This annotation can be applied to either a method or a type:
RequestHandler
, an annotated
POJO, or an implementation of a resource handler interface. This will expose the returned object as a subpath
beneath the handler that the method is a member of.
@Path
-annotated handleable type is returned from a method
on another type also annotated with @Path
, then the type annotation is ignored.
Example:
@RequestHandler(variant = COLLECTION_RESOURCE)
@Path("things")
public class ThingProducer {
@Read
public Promise<ResourceResponse, ResourceException> get(String id) {
// ...
}
@Path("{thing}/subthing")
public SubthingProducer subthing() {
return new SubthingProducer();
}
}
@RequestHandler(variant = SINGLETON_RESOURCE)
public class SubthingProducer {
@Read
public Promise<ResourceResponse, ResourceException> get() {
// ...
}
}
In this example, when an instance of ThingProducer
would result in the following paths being created:
/things
- collection binding to ThingProducer
/things/{id}
- instance binding to ThingProducer
/things/{thing}/subthing
- singleton binding to SubthingProducer
public abstract String value
Copyright © 2010-2018, ForgeRock All Rights Reserved.