|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ResourceBuilder
TODO fix javadoc. Jersey application builder that provides programmatic API for creating server-side JAX-RS / Jersey applications. The programmatic API complements the annotation-based resource API defined by JAX-RS.
A typical use case for the programmatic resource binding API is demonstrated by the following example: JerseyApplication.Builder appBuilder = JerseyApplication.builder();
appBuilder.bind("a")
.method("GET").to(new Inflector<Request, Response>() {
@Override
public Response apply(Request data) {
// ...GET "/a" request method processing
}
})
.method("HEAD", "OPTIONS").to(new Inflector<Request, Response>() {
@Override
public Response apply(Request data) {
// ...HEAD & OPTIONS "/a" request methods processing
}
});
appBuilder
.bind("b")
.method("GET").to(new Inflector<Request, Response>() {
@Override
public Response apply(Request data) {
// ...GET "/b" request method processing
}
})
.subPath("c")
.method("GET").to(new Inflector<Request, Response>() {
@Override
public Response apply(Request data) {
// ...GET "/b/c" request method processing
}
});
appBuilder.build();
The application built in the example above is equivalent to an
application that contains the following annotation-based resources:
@Path("a")
public class ResourceA {
@GET
public Response get(Request request) { ... }
@OPTIONS @HEAD
public Response optionsAndHead(Request request) { ... }
}
@Path("b")
public class ResourceB {
@GET
public Response getB(Request request) { ... }
@Path("c")
@GET
public Response getBC(Request request) { ... }
}
| Nested Class Summary | |
|---|---|
static interface |
ResourceBuilder.BoundResourceBuilder
Represents a supported resource path to which new resource methods and sub-resource locators can be attached. |
static interface |
ResourceBuilder.ResourceMethodBuilder
Jersey application builder used for binding a new resource method to an Inflector<Request, Response> responsible for
processing requests targeted at the bound path and the particular
method(s). |
| Method Summary | |
|---|---|
Set<Resource> |
build()
Build new set of programmatically defined resource bindings. |
ResourceBuilder.BoundResourceBuilder |
path(String path)
Bind a new resource to a path within the application. |
| Method Detail |
|---|
ResourceBuilder.BoundResourceBuilder path(String path)
@Path annotation on an annotation-based
resource class. See the application builder example for
more information.
When invoked, the application builder creates a new bound resource builder that is bound to the supplied path,
relative to the base application URI.
path - resource path relative to the base application URI.
path.Set<Resource> build()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||