Interface RouteBuilder
- All Known Implementing Classes:
AnnotatedFilterRouteBuilder,AnnotatedFunctionRouteBuilder,AnnotatedMethodRouteBuilder,DefaultRouteBuilder,DeleteEndpointRouteBuilder,ReadEndpointRouteBuilder,ServerFilterRouteBuilder,ServerWebSocketProcessor,WriteEndpointRouteBuilder
An interface for classes capable of building HTTP routing information.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA URI naming strategy is used to dictate the default name to use when building a URI for a class. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyConventionUsed to signify to the route that the ID of the resource is used. -
Method Summary
Modifier and TypeMethodDescriptionaddFilter(String pathPattern, BeanLocator beanLocator, BeanDefinition<? extends HttpFilter> beanDefinition) Add a filter.default UriRouteRoute to the specified class.default UriRouteDELETE(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRouteDELETE(Object target, PropertyConvention id) Route to the specified object and ID.default UriRouteDELETE(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRouteDELETE(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP DELETE.Route the specified URI template to the specified target.error(Class<?> originatingClass, Class<? extends Throwable> error, Class<?> type, String method, Class<?>... parameterTypes) Register a route to handle the error.default ErrorRouteRegister a route to handle the error.Register a route to handle the error.default ErrorRouteRegister a route to handle the error.default ErrorRouteRegister a route to handle the error.default ErrorRouteRegister a route to handle the error.default UriRouteRoute to the specified class.default UriRouteGET(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRouteGET(Object target, PropertyConvention id) Route to the specified object and ID.default UriRouteGET(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRouteGET(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP GET.Route the specified URI template to the specified target.default UriRouteRoute to the specified class.default UriRouteHEAD(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRouteHEAD(Object target, PropertyConvention id) Route to the specified object and ID.default UriRouteHEAD(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRouteHEAD(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP GET.Route the specified URI template to the specified target.default UriRouteRoute to the specified class.default UriRouteOPTIONS(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRouteOPTIONS(Object target, PropertyConvention id) Route to the specified object and ID.default UriRouteOPTIONS(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRouteOPTIONS(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP OPTIONS.Route the specified URI template to the specified target.default UriRouteRoute to the specified class.default UriRoutePATCH(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRoutePATCH(Object target, PropertyConvention id) Route to the specified object and ID.default UriRoutePATCH(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRoutePATCH(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP PATCH.Route the specified URI template to the specified target.default UriRouteRoute to the specified class.default UriRoutePOST(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRoutePOST(Object target, PropertyConvention id) Route to the specified object and ID.default UriRoutePOST(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRoutePOST(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP POST.Route the specified URI template to the specified target.default UriRouteRoute to the specified class.default UriRoutePUT(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRoutePUT(Object target, PropertyConvention id) Route to the specified object and ID.default UriRoutePUT(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRoutePUT(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP PUT.Route the specified URI template to the specified target.Builds the necessary mappings to treat the given class as a REST endpoint.default ResourceRouteBuilds the necessary mappings to treat the given instance as a REST endpoint.Builds the necessary mappings to treat the given class as a singular REST endpoint.default ResourceRouteBuilds the necessary mappings to treat the given instance as a singular REST endpoint.status(HttpStatus status, Class<?> type, String method, Class<?>... parameterTypes) Register a route to handle the returned status code.default StatusRoutestatus(HttpStatus status, Object instance, String method) Register a route to handle the returned status code.status(Class<?> originatingClass, HttpStatus status, Class<?> type, String method, Class<?>... parameterTypes) Register a route to handle the returned status code.default UriRouteRoute to the specified class.default UriRouteTRACE(Class<?> type, PropertyConvention id) Route to the specified class and ID.default UriRouteRoute to the specified object.default UriRouteTRACE(Object target, PropertyConvention id) Route to the specified object and ID.default UriRouteTRACE(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.default UriRouteTRACE(String uri, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.Route the specified URI template to the specified target.default UriRouteRoute the specified URI to the specified target for an HTTP GET.Route the specified URI template to the specified target.
-
Field Details
-
ID
Used to signify to the route that the ID of the resource is used.
-
-
Method Details
-
getExposedPorts
- Returns:
- The exposed ports
-
getFilterRoutes
List<FilterRoute> getFilterRoutes()- Returns:
- The filter routes
-
getUriRoutes
- Returns:
- Obtain a list of constructed routes
-
getStatusRoutes
List<StatusRoute> getStatusRoutes()- Returns:
- Obtain a list of constructed routes
-
getErrorRoutes
List<ErrorRoute> getErrorRoutes()- Returns:
- Obtain a list of constructed routes
-
getUriNamingStrategy
RouteBuilder.UriNamingStrategy getUriNamingStrategy()- Returns:
- The URI naming strategy
-
addFilter
FilterRoute addFilter(String pathPattern, BeanLocator beanLocator, BeanDefinition<? extends HttpFilter> beanDefinition) Add a filter.- Parameters:
pathPattern- The path pattern for the filterbeanLocator- The bean locatorbeanDefinition- The bean definition- Returns:
- The
FilterRoute - Since:
- 2.0
-
resources
Builds the necessary mappings to treat the given class as a REST endpoint.
For example given a class called BookController the following routes will be produced:
GET "/book" GET "/book{/id}" POST "/book" PUT "/book{/id}" PATCH "/book{/id}" DELETE "/book{/id}"By default it is assumed the accepted and returned content type is
MediaType.APPLICATION_JSON_TYPE.- Parameters:
cls- The class- Returns:
- The
ResourceRoute
-
resources
Builds the necessary mappings to treat the given instance as a REST endpoint.
- Parameters:
instance- The instance- Returns:
- The
ResourceRoute - See Also:
-
single
Builds the necessary mappings to treat the given class as a singular REST endpoint.
For example given a class called BookController the following routes will be produced:
GET "/book" POST "/book" PUT "/book" PATCH "/book" DELETE "/book"By default it is assumed the accepted and returned content type is
MediaType.APPLICATION_JSON_TYPE.- Parameters:
cls- The class- Returns:
- The
ResourceRoute
-
single
Builds the necessary mappings to treat the given instance as a singular REST endpoint.
- Parameters:
instance- The instance- Returns:
- The
ResourceRoute - See Also:
-
status
Register a route to handle the returned status code.- Parameters:
status- The status codeinstance- The instancemethod- The method- Returns:
- The route
-
status
Register a route to handle the returned status code.- Parameters:
status- The status codetype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
status
StatusRoute status(Class<?> originatingClass, HttpStatus status, Class<?> type, String method, Class<?>... parameterTypes) Register a route to handle the returned status code. This implementation considers the originatingClass for matching.- Parameters:
originatingClass- The class where the error originates fromstatus- The status codetype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
error
ErrorRoute error(Class<? extends Throwable> error, Class<?> type, String method, Class<?>... parameterTypes) Register a route to handle the error.- Parameters:
error- The errortype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
error
ErrorRoute error(Class<?> originatingClass, Class<? extends Throwable> error, Class<?> type, String method, Class<?>... parameterTypes) Register a route to handle the error.- Parameters:
originatingClass- The class where the error originates fromerror- The error typetype- The type to route tomethod- The method to route toparameterTypes- The parameter types for the target method- Returns:
- The route
-
error
Register a route to handle the error.- Parameters:
error- The errortype- The type- Returns:
- The route
-
error
Register a route to handle the error.- Parameters:
error- The errorinstance- The instance- Returns:
- The route
-
error
Register a route to handle the error.- Parameters:
error- The errorinstance- The instancemethod- The method- Returns:
- The route
-
error
default ErrorRoute error(Class<? extends Throwable> error, Object instance, String method, Class<?>... parameterTypes) Register a route to handle the error.- Parameters:
error- The errorinstance- The instancemethod- The methodparameterTypes- The parameter types- Returns:
- The route
-
GET
Route the specified URI to the specified target for an HTTP GET. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
GET
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
GET
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
GET
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
GET
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
GET
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
GET
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
GET
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
GET
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
POST
Route the specified URI to the specified target for an HTTP POST. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target objectparameterTypes- The parameter types for the target method- Returns:
- The route
-
POST
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
POST
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
POST
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
POST
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
POST
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
POST
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
POST
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
POST
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
PUT
Route the specified URI to the specified target for an HTTP PUT. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
PUT
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
PUT
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
PUT
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
PUT
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
PUT
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
PUT
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
PUT
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
PUT
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
PATCH
Route the specified URI to the specified target for an HTTP PATCH. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
PATCH
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
PATCH
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
PATCH
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
PATCH
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
PATCH
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
PATCH
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
PATCH
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
PATCH
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
DELETE
Route the specified URI to the specified target for an HTTP DELETE. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
DELETE
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
DELETE
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
DELETE
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
DELETE
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
DELETE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
DELETE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
DELETE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
DELETE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
OPTIONS
Route the specified URI to the specified target for an HTTP OPTIONS. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
OPTIONS
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
OPTIONS
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
OPTIONS
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
OPTIONS
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
OPTIONS
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
OPTIONS
default UriRoute OPTIONS(String uri, BeanDefinition<?> beanDefinition, ExecutableMethod<?, ?> method) Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
OPTIONS
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
OPTIONS
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
HEAD
Route the specified URI to the specified target for an HTTP GET. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
HEAD
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
HEAD
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
HEAD
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
HEAD
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
HEAD
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
HEAD
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
HEAD
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
HEAD
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
TRACE
Route the specified URI to the specified target for an HTTP GET. Since the method to execute is not specified "index" is used by default.- Parameters:
uri- The URItarget- The target object- Returns:
- The route
-
TRACE
Route to the specified object. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The object- Returns:
- The route
-
TRACE
Route to the specified object and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
target- The objectid- The route id- Returns:
- The route
-
TRACE
Route to the specified class. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The class- Returns:
- The route
-
TRACE
Route to the specified class and ID. The URI route is built by the configured
RouteBuilder.UriNamingStrategy.- Parameters:
type- The classid- The route id- Returns:
- The route
-
TRACE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments.
- Parameters:
uri- The URImethod- The method- Returns:
- The route
-
TRACE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
beanDefinition- The bean definitionuri- The URImethod- The method- Returns:
- The route
-
TRACE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItarget- The targetmethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-
TRACE
Route the specified URI template to the specified target.
The number of variables in the template should match the number of method arguments
- Parameters:
uri- The URItype- The typemethod- The methodparameterTypes- The parameter types for the target method- Returns:
- The route
-