Interface ActionDispatchHost

All Known Implementing Classes:
ServerMarkupContext

public interface ActionDispatchHost
Implemented by request-scoped contexts that participate in the POST-handler dispatch chain via the context.actions registry. The markup template engine checks for this capability after each ka:scope="global" block to decide whether to dispatch a handler for the inbound POST.

Plain templating contexts (no HTTP request) don't implement this interface, so action dispatch is a silent no-op there.

  • Method Summary

    Modifier and Type
    Method
    Description
    The (mutable) registry: action name → JS function.
    boolean
    Whether this request's action handler has already been dispatched.
    void
    Mark this request's action handler as dispatched.
    default void
    Hook installed by the template engine; invoked by the host's context.actions view every time a key is set.
  • Method Details

    • getActions

      Map<String,Object> getActions()
      The (mutable) registry: action name → JS function. JS code populates this via context.actions['name'] = function(form){...}.
    • isActionDispatched

      boolean isActionDispatched()
      Whether this request's action handler has already been dispatched. The framework calls this before each potential dispatch attempt so the handler runs at most once per request.
    • markActionDispatched

      void markActionDispatched()
      Mark this request's action handler as dispatched. Called by the template engine after a successful dispatch.
    • setEagerDispatchHook

      default void setEagerDispatchHook(Consumer<String> hook)
      Hook installed by the template engine; invoked by the host's context.actions view every time a key is set. Lets the engine dispatch the matching handler eagerly — i.e. as soon as it is registered — so any state reads later in the same script block observe post-mutation data. No-op default keeps non-server (plain templating) contexts simple.