Class RouteAttributes

java.lang.Object
io.micronaut.web.router.RouteAttributes

public final class RouteAttributes extends Object
Accessors for various route- and server-related attributes.
Since:
4.8.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static @NonNull Optional<Throwable>
    getException(@NonNull io.micronaut.http.HttpResponse<?> response)
    Get the exception that triggered this response.
    static @NonNull Optional<Object>
    getHeadBody(@NonNull io.micronaut.http.HttpResponse<?> response)
    Get the body that was discarded because this is a response to a HEAD request.
    static @NonNull Optional<RouteInfo<?>>
    getRouteInfo(@NonNull io.micronaut.http.HttpRequest<?> request)
    Get the route info.
    static @NonNull Optional<RouteInfo<?>>
    getRouteInfo(@NonNull io.micronaut.http.HttpResponse<?> response)
    Get the route info.
    static @NonNull Optional<RouteMatch<?>>
    getRouteMatch(@NonNull io.micronaut.http.HttpRequest<?> request)
    Get the route match.
    static @NonNull Optional<RouteMatch<?>>
    getRouteMatch(@NonNull io.micronaut.http.HttpResponse<?> response)
    Get the route match.
    static void
    setException(@NonNull io.micronaut.http.HttpResponse<?> response, @NonNull Throwable throwable)
    Set the exception that triggered this response.
    static void
    setHeadBody(@NonNull io.micronaut.http.HttpResponse<?> response, @NonNull Object body)
    Set the body that was discarded because this is a response to a HEAD request.
    static void
    setRouteInfo(@NonNull io.micronaut.http.HttpRequest<?> request, @NonNull RouteInfo<?> routeInfo)
    Set the route info.
    static void
    setRouteInfo(@NonNull io.micronaut.http.HttpResponse<?> response, @NonNull RouteInfo<?> routeInfo)
    Set the route info.
    static void
    setRouteMatch(@NonNull io.micronaut.http.HttpRequest<?> request, @NonNull RouteMatch<?> routeMatch)
    Set the route match.
    static void
    setRouteMatch(@NonNull io.micronaut.http.HttpResponse<?> response, @NonNull RouteMatch<?> routeMatch)
    Set the route match.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getRouteMatch

      @NonNull public static @NonNull Optional<RouteMatch<?>> getRouteMatch(@NonNull @NonNull io.micronaut.http.HttpRequest<?> request)
      Get the route match.
      Parameters:
      request - The request
      Returns:
      The route match, if present
    • setRouteMatch

      public static void setRouteMatch(@NonNull @NonNull io.micronaut.http.HttpRequest<?> request, @NonNull @NonNull RouteMatch<?> routeMatch)
      Set the route match.
      Parameters:
      request - The request
      routeMatch - The route match
    • getRouteMatch

      @NonNull public static @NonNull Optional<RouteMatch<?>> getRouteMatch(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response)
      Get the route match.
      Parameters:
      response - The response
      Returns:
      The route match, if present
    • setRouteMatch

      public static void setRouteMatch(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response, @NonNull @NonNull RouteMatch<?> routeMatch)
      Set the route match.
      Parameters:
      response - The response
      routeMatch - The route match
    • getRouteInfo

      @NonNull public static @NonNull Optional<RouteInfo<?>> getRouteInfo(@NonNull @NonNull io.micronaut.http.HttpRequest<?> request)
      Get the route info.
      Parameters:
      request - The request
      Returns:
      The route info, if present
    • setRouteInfo

      public static void setRouteInfo(@NonNull @NonNull io.micronaut.http.HttpRequest<?> request, @NonNull @NonNull RouteInfo<?> routeInfo)
      Set the route info.
      Parameters:
      request - The request
      routeInfo - The route info
    • getRouteInfo

      @NonNull public static @NonNull Optional<RouteInfo<?>> getRouteInfo(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response)
      Get the route info.
      Parameters:
      response - The response
      Returns:
      The route info, if present
    • setRouteInfo

      public static void setRouteInfo(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response, @NonNull @NonNull RouteInfo<?> routeInfo)
      Set the route info.
      Parameters:
      response - The response
      routeInfo - The route info
    • getException

      @NonNull public static @NonNull Optional<Throwable> getException(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response)
      Get the exception that triggered this response.
      Parameters:
      response - The response
      Returns:
      The exception, if present
    • setException

      public static void setException(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response, @NonNull @NonNull Throwable throwable)
      Set the exception that triggered this response.
      Parameters:
      response - The response
      throwable - The exception
    • getHeadBody

      @NonNull public static @NonNull Optional<Object> getHeadBody(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response)
      Get the body that was discarded because this is a response to a HEAD request.
      Parameters:
      response - The response
      Returns:
      The discarded body, if present
    • setHeadBody

      public static void setHeadBody(@NonNull @NonNull io.micronaut.http.HttpResponse<?> response, @NonNull @NonNull Object body)
      Set the body that was discarded because this is a response to a HEAD request.
      Parameters:
      response - The response
      body - The body