Package org.jgrapes.http.annotation
Annotation Interface RequestHandler
@Documented
@Retention(RUNTIME)
@Target(METHOD)
@HandlerDefinition(evaluator=Evaluator.class)
public @interface RequestHandler
This annotation marks a method as handler for events.
The method is
invoked for events that have a type derived from Request
and
are matched by one of the specified ResourcePattern
s.
Note that matching uses a shortened request URI for reasons outlined
in Request.In.defaultCriterion()
. Specifying patterns with
more path components than are used by the event’s default criterion
may therefore result in unexpected events. If the default criterion
of an event shortens a requested URI “/foo/bar” to “/foo/**” and
the RequestHandler
annotation specifies “/foo/baz” as pattern,
the handler will be invoked.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This class provides theRequestHandler.Evaluator
for theRequestHandler
annotation. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionSpecifies classes of channels that the handler listens on.boolean
Returns true if the annotated annotation defines a dynamic handler.Specifies classes of events that the handler is to receive.String[]
Specifies the patterns that the handler is supposed to handle (seeResourcePattern
).int
Specifies a priority.
-
Element Details
-
events
Specifies classes of events that the handler is to receive.- Returns:
- the event classes
- Default:
{org.jgrapes.core.annotation.Handler.NoEvent.class}
-
channels
Specifies classes of channels that the handler listens on.- Returns:
- the channel classes
- Default:
{org.jgrapes.core.annotation.Handler.NoChannel.class}
-
patterns
Specifies the patterns that the handler is supposed to handle (seeResourcePattern
).- Returns:
- the patterns
- Default:
{""}
-
priority
int prioritySpecifies a priority.The value is used to sort handlers. Handlers with higher priority are invoked first.
- Returns:
- the priority
- Default:
0
-
dynamic
boolean dynamicReturns true if the annotated annotation defines a dynamic handler.A dynamic handler must be added to the set of handlers of a component explicitly.
- Returns:
- the result
- Default:
false
-