Interface Route

All Known Subinterfaces:
ErrorRoute, ResourceRoute, StatusRoute, UriRoute

public interface Route
Represents a Route definition constructed by a RouteBuilder.
Since:
1.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final List<io.micronaut.http.MediaType>
    The default media type produced by routes.
  • Method Summary

    Modifier and Type
    Method
    Description
    body(io.micronaut.core.type.Argument<?> argument)
    The name of the argument to the route that is the request body.
    body(String argument)
    The name of the argument to the route that is the request body.
    consumes(io.micronaut.http.MediaType... mediaType)
    Applies the given accepted media type the route.
    Accept all MediaType references.
    default List<io.micronaut.http.MediaType>
    The media types able to produced by this route.
    default List<io.micronaut.http.MediaType>
    The media types able to produced by this route.
    nest(Runnable nested)
    Defines routes nested within this route.
    produces(io.micronaut.http.MediaType... mediaType)
    Applies the given accepted media type the route.
     
    where(Predicate<io.micronaut.http.HttpRequest<?>> condition)
    Match this Route only if the given predicate is true.
  • Field Details

    • DEFAULT_PRODUCES

      static final List<io.micronaut.http.MediaType> DEFAULT_PRODUCES
      The default media type produced by routes.
  • Method Details

    • toRouteInfo

      RouteInfo<Object> toRouteInfo()
    • 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 all MediaType references.
      Returns:
      A new route with the media type applied
    • nest

      Route nest(Runnable nested)
      Defines routes nested within this route.
      Parameters:
      nested - The nested routes
      Returns:
      This route
    • where

      Route where(Predicate<io.micronaut.http.HttpRequest<?>> condition)
      Match this Route only if the given predicate is true.
      Parameters:
      condition - The condition which accepts a HttpRequest
      Returns:
      This route
    • body

      Route body(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 List<io.micronaut.http.MediaType> getProduces()
      The media types able to produced by this route.
      Returns:
      A list of MediaType that this route can produce
    • getConsumes

      default List<io.micronaut.http.MediaType> getConsumes()
      The media types able to produced by this route.
      Returns:
      A list of MediaType that this route can produce