java.lang.Object
io.fluxzero.sdk.web.WebHandlerMatcher
- All Implemented Interfaces:
io.fluxzero.common.handling.HandlerMatcher<Object,DeserializingMessage>
public class WebHandlerMatcher
extends Object
implements io.fluxzero.common.handling.HandlerMatcher<Object,DeserializingMessage>
Specialized
HandlerMatcher that routes DeserializingMessages of type MessageType.WEBREQUEST
to matching handler methods based on annotated URI patterns, HTTP methods, and optional origins.
This matcher is created internally by the HandlerFactory when registering a handler class that contains
methods annotated for web request handling (e.g., @HandleWeb).
Routing Logic
The matcher builds aRouter that maps:
- HTTP method (e.g., GET, POST)
- Normalized path (optionally prefixed by
@Pathat class or package level) - Optional request origin (e.g., scheme and host) when specified in the handler method
DefaultWebRequestContext is used to extract the URI path, method, and origin
from the incoming request metadata.
WebPattern Matching
Each handler method may be associated with one or moreWebPatterns, derived from WebParameters
annotations. These patterns define the matchable paths and methods.
Support for @Path Annotations
This matcher also respects@Path annotations on the method, declaring class, or package level,
combining those with the WebPattern#getPath() when routing requests.
Fallback to ANY Method
If no handler matches the exact request method, but any handlers exist that declareHttpRequestMethod.ANY,
these are checked as a fallback.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWebHandlerMatcher(Object handler, List<io.fluxzero.common.handling.HandlerInspector.MethodHandlerMatcher<DeserializingMessage>> methodHandlerMatchers) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(DeserializingMessage message) protected static WebHandlerMatchercreate(Object handler, Class<?> type, List<io.fluxzero.common.handling.ParameterResolver<? super DeserializingMessage>> parameterResolvers, io.fluxzero.common.handling.HandlerConfiguration<DeserializingMessage> config) static WebHandlerMatchercreate(Object handler, List<io.fluxzero.common.handling.ParameterResolver<? super DeserializingMessage>> parameterResolvers, io.fluxzero.common.handling.HandlerConfiguration<DeserializingMessage> config) Optional<io.fluxzero.common.handling.HandlerInvoker> getInvoker(Object target, DeserializingMessage message) matchingMethods(DeserializingMessage message) protected Optional<io.fluxzero.common.handling.HandlerInspector.MethodHandlerMatcher<DeserializingMessage>> methodMatcher(DeserializingMessage message) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.fluxzero.common.handling.HandlerMatcher
or
-
Constructor Details
-
WebHandlerMatcher
protected WebHandlerMatcher(Object handler, List<io.fluxzero.common.handling.HandlerInspector.MethodHandlerMatcher<DeserializingMessage>> methodHandlerMatchers)
-
-
Method Details
-
create
public static WebHandlerMatcher create(Object handler, List<io.fluxzero.common.handling.ParameterResolver<? super DeserializingMessage>> parameterResolvers, io.fluxzero.common.handling.HandlerConfiguration<DeserializingMessage> config) -
create
protected static WebHandlerMatcher create(Object handler, Class<?> type, List<io.fluxzero.common.handling.ParameterResolver<? super DeserializingMessage>> parameterResolvers, io.fluxzero.common.handling.HandlerConfiguration<DeserializingMessage> config) -
canHandle
- Specified by:
canHandlein interfaceio.fluxzero.common.handling.HandlerMatcher<Object,DeserializingMessage>
-
matchingMethods
- Specified by:
matchingMethodsin interfaceio.fluxzero.common.handling.HandlerMatcher<Object,DeserializingMessage>
-
getInvoker
public Optional<io.fluxzero.common.handling.HandlerInvoker> getInvoker(Object target, DeserializingMessage message) - Specified by:
getInvokerin interfaceio.fluxzero.common.handling.HandlerMatcher<Object,DeserializingMessage>
-
methodMatcher
protected Optional<io.fluxzero.common.handling.HandlerInspector.MethodHandlerMatcher<DeserializingMessage>> methodMatcher(DeserializingMessage message)
-