Package io.quarkiverse.renarde.htmx
Class HxController
java.lang.Object
io.quarkiverse.renarde.Controller
io.quarkiverse.renarde.htmx.HxController
This is a Controller's overlay to simplify usage of Quarkus Renarde alongside .
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected jakarta.ws.rs.core.HttpHeadersstatic final Stringprotected io.vertx.core.http.HttpServerResponseFields inherited from class io.quarkiverse.renarde.Controller
flash, i18n, identity, renderArgs, uriInfo, validation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis hook is called before any redirects caused by calls to controller public methods, including redirect(FooController.class).method().static io.quarkus.qute.TemplateInstanceconcatTemplates(io.quarkus.qute.TemplateInstance... templates) This Qute helper make it easy to achieve htmx "Out of Band" swap by choosing which templates to return (refresh).protected voidKeep the htmx flag for the redirect request.protected Stringhx(HxController.HxRequestHeader header) protected voidhx(HxController.HxResponseHeader hxHeader, String value) Helper to define htmx response headers.protected booleanCheck if this request has the htmx flag (header or flash data)protected voidMake sure only htmx requests are calling this method.Methods inherited from class io.quarkiverse.renarde.Controller
badRequest, emptyAsNull, flash, forbidden, forbidden, notFound, notFound, notFoundIfNull, prepareForErrorRedirect, redirect, seeOther, seeOther, temporaryRedirect, validationFailed
-
Field Details
-
HX_REQUEST_HEADER
- See Also:
-
httpHeaders
@Inject protected jakarta.ws.rs.core.HttpHeaders httpHeaders -
response
@Inject protected io.vertx.core.http.HttpServerResponse response
-
-
Constructor Details
-
HxController
public HxController()
-
-
Method Details
-
concatTemplates
public static io.quarkus.qute.TemplateInstance concatTemplates(io.quarkus.qute.TemplateInstance... templates) This Qute helper make it easy to achieve htmx "Out of Band" swap by choosing which templates to return (refresh).
- Parameters:
templates- the list of template instances to concatenate- Returns:
- the concatenated templates instances
-
isHxRequest
protected boolean isHxRequest()Check if this request has the htmx flag (header or flash data) -
hx
Helper to define htmx response headers.- Parameters:
hxHeader- theHxController.HxResponseHeaderto definevalue- the value for this header
-
hx
-
onlyHxRequest
protected void onlyHxRequest()Make sure only htmx requests are calling this method. -
flashHxRequest
protected void flashHxRequest()Keep the htmx flag for the redirect request. This is automatic. -
beforeRedirect
protected void beforeRedirect()Description copied from class:ControllerThis hook is called before any redirects caused by calls to controller public methods, including redirect(FooController.class).method().- Overrides:
beforeRedirectin classController
-