Package io.micronaut.views.htmx.http
Interface HtmxRequestHeaders
public interface HtmxRequestHeaders
HTMX Request Headers.
- Since:
- 5.2.0
- Author:
- Sergio del Amo
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIndicates that the request comes from an element that uses hx-boost.static final StringThe current URL of the browser.static final StringIndicates if the request is for history restoration after a miss in the local history cache.static final StringThe user response to a hx-prompt.static final StringOnly present andtrueif the request is issued by htmx.static final StringTheidof the target element if it exists.static final StringTheidof the triggered element if it exists.static final StringThenameof the triggered element if it exists. -
Method Summary
Modifier and TypeMethodDescription@Nullable String@Nullable String@Nullable String@Nullable String@Nullable String@Nullable StringbooleanisBoost()static Optional<HtmxRequestHeaders>of(io.micronaut.http.HttpHeaders headers) static @NonNull Optional<HtmxRequestHeaders>of(io.micronaut.http.HttpRequest<?> request)
-
Field Details
-
HX_BOOSTED
Indicates that the request comes from an element that uses hx-boost.- See Also:
-
HX_CURRENT_URL
The current URL of the browser.- See Also:
-
HX_HISTORY_RESTORE_REQUEST
Indicates if the request is for history restoration after a miss in the local history cache.- See Also:
-
HX_PROMPT
The user response to a hx-prompt.- See Also:
-
HX_REQUEST
Only present andtrueif the request is issued by htmx.- See Also:
-
HX_TARGET
Theidof the target element if it exists.- See Also:
-
HX_TRIGGER_NAME
Thenameof the triggered element if it exists.- See Also:
-
HX_TRIGGER
Theidof the triggered element if it exists.- See Also:
-
-
Method Details
-
isBoost
boolean isBoost()- Returns:
- Indicates that the request is via an element using hx-boost
-
getCurrentUrl
- Returns:
- the current URL of the browser
-
getHistoryRestoreRequest
- Returns:
- “true” if the request is for history restoration after a miss in the local history cache
-
getPrompt
- Returns:
- the user response to an hx-prompt
-
getTarget
- Returns:
- the id of the target element if it exists
-
getTriggerName
- Returns:
- the name of the triggered element if it exists
-
getTrigger
- Returns:
- the id of the triggered element if it exists
-
of
- Parameters:
headers- HTTP Headers- Returns:
- an Optional of HtmxRequestHeaders
-
of
- Parameters:
request- HTTP Request- Returns:
- an Optional of HtmxRequestHeaders
-