Class UiConfigHandler

java.lang.Object
org.codelibs.fess.api.v2.handlers.UiConfigHandler

public class UiConfigHandler extends Object
Handles GET /api/v2/ui/config.

Returns the SPA bootstrap payload: site name, login requirement, supported locales, the active theme descriptor, feature flags, paging defaults, and a freshly-issued CSRF token. The endpoint is GET-only and CSRF-exempt because it is the canonical way for an unauthenticated client to obtain a token in the first place.

The handler is defensive: a missing ThemeRegistry or any unexpected exception during payload assembly is caught and emitted as a structured envelope (status:9, error.code:"internal_error") so the SPA always sees a parseable response — never a leaked stack trace.

  • Constructor Details

    • UiConfigHandler

      public UiConfigHandler()
      Default constructor. The handler is stateless and intended to be instantiated once by the API manager and shared across concurrent requests.
  • Method Details

    • handle

      public void handle(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse res) throws IOException
      Processes one /api/v2/ui/config GET request.

      Rejects non-GET methods with V2ErrorCode.METHOD_NOT_ALLOWED. Otherwise assembles the SPA bootstrap payload — site name, login requirement, supported locales, active theme descriptor, feature flags, paging defaults, and a freshly-issued CSRF token bound to the session (always required now) — and writes it via the standard v2 envelope. Any unexpected exception is caught and emitted as a structured internal_error envelope.

      Parameters:
      req - the incoming HTTP request
      res - the HTTP response to write to
      Throws:
      IOException - if writing the envelope fails