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:
- Locates the project root from its own filesystem position.
- Confirms
juneau-petstore/juneau-petstore-jetty/target/classesexists; if not, runsmvn clean compilefirst. - Invokes
mvn exec:java -Dexec.mainClass=org.apache.juneau.petstore.jetty.Appfrom 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/mustacheshows 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 useAuthorization: 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+
Related
- See juneau-petstore Overview for the application architecture.
- See start-petstore-springboot.py for the Spring Boot variant.