Package org.apache.juneau.petstore.rest
Class PetstoreUiResource
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.juneau.rest.server.servlet.RestServlet
org.apache.juneau.rest.server.servlet.BasicRestServlet
org.apache.juneau.petstore.rest.PetstoreUiResource
- 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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.rest.server.servlet.RestServlet
RestServlet.Builder<R extends RestServlet,SELF extends RestServlet.Builder<R, SELF>>, RestServlet.DefaultBuilder<R extends RestServlet> -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapp(RestRequest req, Locale locale) [GET /] — the single-page app.Methods inherited from class org.apache.juneau.rest.server.servlet.RestServlet
builder, createAuthenticator, destroy, doLog, getContext, getPath, getPaths, getRequest, getResponse, getRestBuilder, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
PetstoreUiResource
public PetstoreUiResource()
-
-
Method Details
-
app
[GET /] — the single-page app.- Parameters:
req- The current request.locale- The request locale.- Returns:
- The app's HTML page.
-