Skip to main content

start-petstore-jetty.py

start-petstore-jetty.py starts the Juneau petstore sample application using the embedded Jetty/Microservice container. It is a convenience launcher equivalent to running the org.apache.juneau.petstore.jetty.App main class via Maven's exec plugin.

What It Does​

The script:

  1. Locates the project root from its own filesystem position.
  2. Confirms juneau-petstore/juneau-petstore-jetty/target/classes exists; if not, runs mvn clean compile first.
  3. Invokes mvn exec:java -Dexec.mainClass=org.apache.juneau.petstore.jetty.App from the petstore-jetty module directory.

Usage​

python3 scripts/start-petstore-jetty.py [--port N]

--port N sets the port to listen on (default 10000); use it when another server already holds 10000. The script passes it to the petstore as the petstore.port system property, which juneau-petstore-jetty.cfg's [Jetty]/port entry reads, so the cfg file is never edited.

The petstore boots on http://localhost:10000 by default. The microservice console is enabled — type help for available commands or exit to stop.

Useful URLs once running​

  • GET http://localhost:10000/petstore/pets — full pet listing.
  • GET http://localhost:10000/petstore/pets/1 — single seeded pet (Mr. Frisky).
  • GET http://localhost:10000/console/store, /console/pets — the petstore admin console; /console/dev/flavors/mustache shows the Mustache-rendered flavor.
  • GET http://localhost:10000/petstore-ui/static/petstore-ui.html — React SPA demo.
  • GET http://localhost:10000/console/dev/secure — bearer-token demo (secure API calls use Authorization: Bearer petstore-user).
  • GET http://localhost:10000/petstore — Swagger UI for the petstore API.

Requirements​

  • Python 3.6 or higher
  • Maven (must be on PATH)
  • Java 17+