Class DefaultRequestMatcher<T,R>

java.lang.Object
io.micronaut.web.router.DefaultRouteInfo<R>
io.micronaut.web.router.DefaultRequestMatcher<T,R>
Type Parameters:
T - The target
R - The result
All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, MethodBasedRouteInfo<T,R>, RequestMatcher, RouteInfo<R>
Direct Known Subclasses:
DefaultErrorRouteInfo, DefaultStatusRouteInfo, DefaultUrlRouteInfo

@Internal public sealed class DefaultRequestMatcher<T,R> extends DefaultRouteInfo<R> implements RequestMatcher permits DefaultErrorRouteInfo<T,R>, DefaultStatusRouteInfo<T,R>, DefaultUrlRouteInfo<T,R>
The default RequestMatcher implementation.
Since:
4.0.0
  • Constructor Details

    • DefaultRequestMatcher

      public DefaultRequestMatcher(io.micronaut.inject.MethodExecutionHandle<T,R> targetMethod, io.micronaut.core.type.Argument<?> bodyArgument, String bodyArgumentName, List<io.micronaut.http.MediaType> producesMediaTypes, List<io.micronaut.http.MediaType> consumesMediaTypes, boolean isPermitsBody, boolean isErrorRoute, List<Predicate<io.micronaut.http.HttpRequest<?>>> predicates, io.micronaut.http.body.MessageBodyHandlerRegistry messageBodyHandlerRegistry)
  • Method Details

    • matching

      public boolean matching(io.micronaut.http.HttpRequest<?> httpRequest)
      Description copied from interface: RequestMatcher
      Match the given request.
      Specified by:
      matching in interface RequestMatcher
      Parameters:
      httpRequest - The request
      Returns:
      true if route matches this request
    • getMessageBodyReader

      public final io.micronaut.http.body.MessageBodyReader<?> getMessageBodyReader()
      Specified by:
      getMessageBodyReader in interface RouteInfo<T>
      Returns:
      The message body reader. if any.
    • resolveArgumentBinders

      public io.micronaut.http.bind.binders.RequestArgumentBinder<Object>[] resolveArgumentBinders(io.micronaut.http.bind.RequestBinderRegistry requestBinderRegistry)
      Specified by:
      resolveArgumentBinders in interface MethodBasedRouteInfo<T,R>
    • isVoid

      public boolean isVoid()
      Specified by:
      isVoid in interface RouteInfo<T>
      Overrides:
      isVoid in class DefaultRouteInfo<R>
      Returns:
      Does the route return void
    • getTargetMethod

      public io.micronaut.inject.MethodExecutionHandle<T,R> getTargetMethod()
      Specified by:
      getTargetMethod in interface MethodBasedRouteInfo<T,R>
      Returns:
      The MethodExecutionHandle
    • getRequestBodyType

      public Optional<io.micronaut.core.type.Argument<?>> getRequestBodyType()
      Specified by:
      getRequestBodyType in interface RouteInfo<T>
      Overrides:
      getRequestBodyType in class DefaultRouteInfo<R>
      Returns:
      The argument that represents the body of the request
    • getFullRequestBodyType

      public Optional<io.micronaut.core.type.Argument<?>> getFullRequestBodyType()
      Description copied from interface: RouteInfo
      Like RouteInfo.getRequestBodyType(), but excludes body arguments that may match only a part of the body (i.e. that have no @Body annotation, or where the @Body has a value set).
      Specified by:
      getFullRequestBodyType in interface RouteInfo<T>
      Returns:
      The argument that represents the body
    • getArgumentNames

      public String[] getArgumentNames()
      Specified by:
      getArgumentNames in interface MethodBasedRouteInfo<T,R>
    • needsRequestBody

      public boolean needsRequestBody()
      Specified by:
      needsRequestBody in interface RouteInfo<T>
      Overrides:
      needsRequestBody in class DefaultRouteInfo<R>
      Returns:
      true if the route needs request body to be read