Class PetstoreUiResource

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable, BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig

Petstore React SPA demo — serves the no-build single-page React UI from the core classpath.

Composes StaticFilesMixin to serve /static/* from the importer's classpath: the file static/petstore-ui.html is reachable at GET /petstore-ui/static/petstore-ui.html. The HTML loads the vendored React + ReactDOM bundles (static/vendor/) and uses fetch() against /petstore/pets to demonstrate the headless-JSON + decoupled-SPA pattern alongside the server-rendered HTML-doc UI.

The app is also served at the resource root (GET /petstore-ui), so the console can embed and link it without knowing the static mount.

Lives in juneau-petstore-core so both the Jetty and Spring Boot deployments inherit it for free.

See Also:
See Also:
  • Constructor Details

  • Method Details

    • app

      public HttpResource app(RestRequest req, Locale locale)
      [GET /] — the single-page app.
      Parameters:
      req - The current request.
      locale - The request locale.
      Returns:
      The app's HTML page.