Class PetstoreConsolePage
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.console.PetstoreConsolePage
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,BasicUniversalConfig,DefaultConfig,DefaultHtmlConfig
- Direct Known Subclasses:
AboutRest,AuditRest,ChangesRest,ChartsRest,CustomCardsRest,DashboardRest,DataRest,DevRest,FlavorsRest,FreemarkerFlavorRest,HtmlFlavorRest,JobsRest,MustacheFlavorRest,OpsRest,OrdersRest,PetsRest,PetstoreConsoleResource,SecureApiRest,SecureRest,StoreRest,ThemesRest,UsersRest
Base class for every petstore console page resource: registers the console FreeMarker mixin with
base.ftlh as chrome, and injects the shared PetStore.
Children don't inherit the parent's mixins, so every page class extends this one instead of re-declaring the mixin, which E-B12 would reject.
The views and DataTables toolkit packs link their assets page-relative (e.g. /console/store/juneau-views.js),
so every page also composes ViewsMixin and DataTablesMixin to serve them from its own mount.
Example:
- 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
FieldsModifier and TypeFieldDescriptionstatic final StringResponse header naming the render path of a builder-twin page, so a twin test can tell the two paths apart.static final StringClasspath folder holding the console templates.Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbuilder(RestRequest req) Whether this request asks for the builder twin of a page (?builder, with or without a value).The console FreeMarker mixin: petstore templates,base.ftlhchrome,assetUrl(..)over this package's bundled scripts, and theInventoryGaugeCardTypecustom card type.protected PetStorestore()static Viewtwin(RestRequest req, PageSpec spec) Renders a builder-twin page, marked withPAGE_HEADER.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
-
Field Details
-
TEMPLATES
Classpath folder holding the console templates.- See Also:
-
PAGE_HEADER
Response header naming the render path of a builder-twin page, so a twin test can tell the two paths apart.- See Also:
-
-
Constructor Details
-
PetstoreConsolePage
public PetstoreConsolePage()
-
-
Method Details
-
builder
Whether this request asks for the builder twin of a page (?builder, with or without a value).- Parameters:
req- The request.- Returns:
true if the page should render from itsPageSpec.
-
twin
Renders a builder-twin page, marked withPAGE_HEADER.- Parameters:
req- The request.spec- The page spec.- Returns:
- The view.
-
freemarker
The console FreeMarker mixin: petstore templates,base.ftlhchrome,assetUrl(..)over this package's bundled scripts, and theInventoryGaugeCardTypecustom card type.- Returns:
- The mixin.
-
store
- Returns:
- The shared store.
- Throws:
IllegalStateException- If noPetStore@Beanwas wired into the host.
-