Class HtmxRequest


  • public final class HtmxRequest
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  HtmxRequest.Builder  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCurrentUrl()
      The current URL of the browser when the htmx request was made.
      java.lang.String getPromptResponse()
      The user response to an hx-prompt.
      java.lang.String getTarget()
      The id of the target element if it exists.
      java.lang.String getTriggerId()
      The id of the triggered element if it exists.
      java.lang.String getTriggerName()
      The name of the triggered element if it exists.
      boolean isBoosted()
      Indicates that the request is via an element using hx-boost.
      boolean isHistoryRestoreRequest()
      Indicates if the request is for history restoration after a miss in the local history cache
      boolean isHtmxRequest()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isHtmxRequest

        public boolean isHtmxRequest()
      • isBoosted

        public boolean isBoosted()
        Indicates that the request is via an element using hx-boost.
        Returns:
        true if the request was made via hx-boost, false otherwise
      • getCurrentUrl

        @Nullable
        public java.lang.String getCurrentUrl()
        The current URL of the browser when the htmx request was made.
        Returns:
        the URL, or null if the URL was not passed
      • isHistoryRestoreRequest

        public boolean isHistoryRestoreRequest()
        Indicates if the request is for history restoration after a miss in the local history cache
        Returns:
        true if this request is for history restoration, false otherwise
      • getPromptResponse

        @Nullable
        public java.lang.String getPromptResponse()
        The user response to an hx-prompt.
        Returns:
        The response of the user. Can be null.
      • getTarget

        @Nullable
        public java.lang.String getTarget()
        The id of the target element if it exists.
        Returns:
        the id, or null if no id was passed in the request
      • getTriggerName

        @Nullable
        public java.lang.String getTriggerName()
        The name of the triggered element if it exists.
        Returns:
        the name of the trigger, or null if no name was passed in the request
      • getTriggerId

        @Nullable
        public java.lang.String getTriggerId()
        The id of the triggered element if it exists.
        Returns:
        the id of the trigger, or null if no name was passed in the request