Class HxController

java.lang.Object
io.quarkiverse.renarde.Controller
io.quarkiverse.renarde.htmx.HxController

public abstract class HxController extends Controller
This is a Controller's overlay to simplify usage of Quarkus Renarde alongside .
  • Field Details

    • HX_REQUEST_HEADER

      public static final String 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

      protected void hx(HxController.HxResponseHeader hxHeader, String value)
      Helper to define htmx response headers.
      Parameters:
      hxHeader - the HxController.HxResponseHeader to define
      value - the value for this header
    • hx

      protected String hx(HxController.HxRequestHeader header)
    • 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: Controller
      This hook is called before any redirects caused by calls to controller public methods, including redirect(FooController.class).method().
      Overrides:
      beforeRedirect in class Controller