Package io.micronaut.web.router
Class DefaultRequestMatcher<T,R>
java.lang.Object
io.micronaut.web.router.DefaultRouteInfo<R>
io.micronaut.web.router.DefaultRequestMatcher<T,R>
- Type Parameters:
T
- The targetR
- The result
- All Implemented Interfaces:
AnnotationMetadataProvider
,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
- Author:
- Denis Stepanov
-
Field Summary
Fields inherited from class io.micronaut.web.router.DefaultRouteInfo
annotationMetadata, consumesMediaTypes, consumesMediaTypesContainsAll, declaringType, definedStatus, isWebSocketRoute, producesMediaTypes, producesMediaTypesContainsAll, returnType
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
Fields inherited from interface io.micronaut.web.router.RouteInfo
DEFAULT_PRODUCES
-
Constructor Summary
ConstructorDescriptionDefaultRequestMatcher
(MethodExecutionHandle<T, R> targetMethod, Argument<?> bodyArgument, String bodyArgumentName, List<MediaType> producesMediaTypes, List<MediaType> consumesMediaTypes, boolean isPermitsBody, boolean isErrorRoute, List<Predicate<HttpRequest<?>>> predicates, MessageBodyHandlerRegistry messageBodyHandlerRegistry) -
Method Summary
Modifier and TypeMethodDescriptionString[]
LikeRouteInfo.getRequestBodyType()
, but excludes body arguments that may match only a part of the body (i.e.final MessageBodyReader<?>
boolean
isVoid()
boolean
matching
(HttpRequest<?> httpRequest) Match the given request.boolean
resolveArgumentBinders
(RequestBinderRegistry requestBinderRegistry) Methods inherited from class io.micronaut.web.router.DefaultRouteInfo
consumesAll, doesConsume, doesProduce, doesProduce, explicitlyConsumes, explicitlyProduces, findStatus, getAnnotationMetadata, getConsumes, getDeclaringType, getExecutor, getMessageBodyWriter, getProduces, getResponseBodyType, getReturnType, isAsync, isAsyncOrReactive, isCompletable, isErrorRoute, isImperative, isPermitsRequestBody, isReactive, isSingleResult, isSpecifiedSingle, isSuspended, isWebSocketRoute, producesAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
Methods inherited from interface io.micronaut.web.router.RouteInfo
consumesAll, doesConsume, doesProduce, doesProduce, explicitlyConsumes, explicitlyProduces, findStatus, getBodyArgument, getBodyType, getConsumes, getDeclaringType, getExecutor, getMessageBodyWriter, getProduces, getResponseBodyType, getReturnType, isAsync, isAsyncOrReactive, isCompletable, isErrorRoute, isImperative, isPermitsRequestBody, isReactive, isResponseBodyJsonFormattable, isSingleResult, isSpecifiedSingle, isSuspended, isWebSocketRoute, producesAll
-
Constructor Details
-
DefaultRequestMatcher
public DefaultRequestMatcher(MethodExecutionHandle<T, R> targetMethod, Argument<?> bodyArgument, String bodyArgumentName, List<MediaType> producesMediaTypes, List<MediaType> consumesMediaTypes, boolean isPermitsBody, boolean isErrorRoute, List<Predicate<HttpRequest<?>>> predicates, MessageBodyHandlerRegistry messageBodyHandlerRegistry)
-
-
Method Details
-
matching
Description copied from interface:RequestMatcher
Match the given request.- Specified by:
matching
in interfaceRequestMatcher
- Parameters:
httpRequest
- The request- Returns:
- true if route matches this request
-
getMessageBodyReader
- Specified by:
getMessageBodyReader
in interfaceRouteInfo<T>
- Returns:
- The message body reader. if any.
-
resolveArgumentBinders
public RequestArgumentBinder<Object>[] resolveArgumentBinders(RequestBinderRegistry requestBinderRegistry) - Specified by:
resolveArgumentBinders
in interfaceMethodBasedRouteInfo<T,
R>
-
isVoid
public boolean isVoid()- Specified by:
isVoid
in interfaceRouteInfo<T>
- Overrides:
isVoid
in classDefaultRouteInfo<R>
- Returns:
- Does the route return void
-
getTargetMethod
- Specified by:
getTargetMethod
in interfaceMethodBasedRouteInfo<T,
R> - Returns:
- The
MethodExecutionHandle
-
getRequestBodyType
- Specified by:
getRequestBodyType
in interfaceRouteInfo<T>
- Overrides:
getRequestBodyType
in classDefaultRouteInfo<R>
- Returns:
- The argument that represents the body of the request
-
getFullRequestBodyType
Description copied from interface:RouteInfo
LikeRouteInfo.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 interfaceRouteInfo<T>
- Returns:
- The argument that represents the body
-
getArgumentNames
- Specified by:
getArgumentNames
in interfaceMethodBasedRouteInfo<T,
R>
-
needsRequestBody
public boolean needsRequestBody()- Specified by:
needsRequestBody
in interfaceRouteInfo<T>
- Overrides:
needsRequestBody
in classDefaultRouteInfo<R>
- Returns:
- true if the route needs request body to be read
-