Package io.micronaut.web.router
Interface Route
-
- All Known Subinterfaces:
ErrorRoute,MethodBasedRoute,ResourceRoute,StatusRoute,UriRoute
public interface RouteRepresents a Route definition constructed by aRouteBuilder.- Since:
- 1.0
- See Also:
RouteBuilder,ResourceRoute
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<io.micronaut.http.MediaType>DEFAULT_PRODUCESThe default media type produced by routes.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Routebody(io.micronaut.core.type.Argument<?> argument)The name of the argument to the route that is the request body.Routebody(java.lang.String argument)The name of the argument to the route that is the request body.Routeconsumes(io.micronaut.http.MediaType... mediaType)Applies the given accepted media type the route.RouteconsumesAll()Accept allMediaTypereferences.default java.util.List<io.micronaut.http.MediaType>getConsumes()The media types able to produced by this route.default java.util.List<io.micronaut.http.MediaType>getProduces()The media types able to produced by this route.Routenest(java.lang.Runnable nested)Defines routes nested within this route.Routeproduces(io.micronaut.http.MediaType... mediaType)Applies the given accepted media type the route.Routewhere(java.util.function.Predicate<io.micronaut.http.HttpRequest<?>> condition)Match thisRouteonly if the given predicate is true.
-
-
-
Method Detail
-
consumes
Route consumes(io.micronaut.http.MediaType... mediaType)
Applies the given accepted media type the route.- Parameters:
mediaType- The media type- Returns:
- A new route with the media type applied
-
produces
Route produces(io.micronaut.http.MediaType... mediaType)
Applies the given accepted media type the route.- Parameters:
mediaType- The media type- Returns:
- A new route with the media type applied
-
consumesAll
Route consumesAll()
Accept allMediaTypereferences.- Returns:
- A new route with the media type applied
-
nest
Route nest(java.lang.Runnable nested)
Defines routes nested within this route.- Parameters:
nested- The nested routes- Returns:
- This route
-
where
Route where(java.util.function.Predicate<io.micronaut.http.HttpRequest<?>> condition)
Match thisRouteonly if the given predicate is true.- Parameters:
condition- The condition which accepts aHttpRequest- Returns:
- This route
-
body
Route body(java.lang.String argument)
The name of the argument to the route that is the request body.- Parameters:
argument- The argument- Returns:
- This route
-
body
Route body(io.micronaut.core.type.Argument<?> argument)
The name of the argument to the route that is the request body.- Parameters:
argument- The argument- Returns:
- This route
-
getProduces
default java.util.List<io.micronaut.http.MediaType> getProduces()
The media types able to produced by this route.- Returns:
- A list of
MediaTypethat this route can produce
-
getConsumes
default java.util.List<io.micronaut.http.MediaType> getConsumes()
The media types able to produced by this route.- Returns:
- A list of
MediaTypethat this route can produce
-
-