Annotation Type HxRequest


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface HxRequest
Mark a controller method as handling Htmx requests and potentially restrict the handler to only be used for specific Htmx target or Htmx trigger.

Controller methods with @HxRequest require the HX-Request HTTP Header to be set for the handler to process the request. Additionally, we can specify target(), triggerId(), or triggerName() such that the handler is only invoked specifically for requests with those matching headers.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Restricts the mapping to the id of a specific target element.
    Restricts the mapping to the id of a specific triggered element.
    Restricts the mapping to the name of a specific triggered element.
    Restricts the mapping to the id, if any, or to the name of a specific triggered element.
  • Element Details

    • target

      String target
      Restricts the mapping to the id of a specific target element.
      See Also:
      Default:
      ""
    • triggerId

      String triggerId
      Restricts the mapping to the id of a specific triggered element.
      See Also:
      Default:
      ""
    • triggerName

      String triggerName
      Restricts the mapping to the name of a specific triggered element.
      See Also:
      Default:
      ""
    • value

      String value
      Restricts the mapping to the id, if any, or to the name of a specific triggered element.

      If you want to be explicit use triggerId() or triggerName().

      See Also:
      Default:
      ""