Annotation 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 ResourcePatterns.

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.

  • Element Details

    • events

      Class<? extends Event>[] events
      Specifies classes of events that the handler is to receive.
      Returns:
      the event classes
      Default:
      {org.jgrapes.core.annotation.Handler.NoEvent.class}
    • channels

      Class<? extends Channel>[] 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 (see ResourcePattern).
      Returns:
      the patterns
      Default:
      {""}
    • priority

      Specifies a priority.

      The value is used to sort handlers. Handlers with higher priority are invoked first.

      Returns:
      the priority
      Default:
      0
    • dynamic

      boolean dynamic
      Returns 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