Class PetstoreConsoleResource

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

Root of the petstore admin console, mounted at /console beside the /petstore API and sharing its PetStore.

Every page renders through base.ftlh (the <@console> chrome and nav tree).

Example:

// Mount it in a runner beside the API; both see the same @Bean PetStore. @Rest(children={PetStoreResource.class, PetstoreConsoleResource.class}) public class RootResources extends BasicRestServletGroup { @Bean public PetStore petStore() { return PetstoreSeed.create().populate(new PetStore()); } }

<#-- base.ftlh --> <@console brand="Juneau Petstore"> <@navigation><@node id="store" label="Store" href="/console/store"/> ... </@navigation> <@main/> </@console>

See Also:
  • Constructor Details

  • Method Details

    • index

      public SeeOther index(RestRequest req)
      GET /console redirects to the store dashboard.
      Parameters:
      req - The request.
      Returns:
      A 303 to /console/store.
    • script

      public void script(RestResponse res) throws IOException
      Serves petstore.js, the shared page script base.ftlh loads after the toolkit on every page.
      Parameters:
      res - The response.
      Throws:
      IOException - If the bundled script can't be read.