Package io.github.wimdeblauwe.hsbt.mvc
Class HtmxRequest
- java.lang.Object
-
- io.github.wimdeblauwe.hsbt.mvc.HtmxRequest
-
public final class HtmxRequest extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHtmxRequest.Builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCurrentUrl()The current URL of the browser when the htmx request was made.java.lang.StringgetPromptResponse()The user response to an hx-prompt.java.lang.StringgetTarget()The id of the target element if it exists.java.lang.StringgetTriggerId()The id of the triggered element if it exists.java.lang.StringgetTriggerName()The name of the triggered element if it exists.booleanisBoosted()Indicates that the request is via an element using hx-boost.booleanisHistoryRestoreRequest()Indicates if the request is for history restoration after a miss in the local history cachebooleanisHtmxRequest()
-
-
-
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
-
-