Select Git revision
modules.xml
README.md 2.18 KiB
A not so simple JAX-RS example
Usage
Compile, package, and run Integration Tests (verify). Launch the REST Server.
git clone --branch jakarta \
https://github.com/emmanuelbruno/cours-java-librarymanager-rest.git
mvn clean verify && \
mvn exec:java
Get a Hello message
curl -s -D - http://localhost:9998/myapp/biblio
Init the database with two authors
curl -s -D - -X PUT "http://localhost:9998/myapp/biblio/init"
Get author 1 in JSON
curl -s -D - -H "Accept: application/json" \
http://localhost:9998/myapp/biblio/auteurs/1
Get author 2 in XML
curl -s -D - -H "Accept: text/xml" \
http://localhost:9998/myapp/biblio/auteurs/2
Get authors in JSON
curl -s -D - -H "Accept: application/json" \
http://localhost:9998/myapp/biblio/auteurs
Removes an author
curl -s -D - -X DELETE "http://localhost:9998/myapp/biblio/auteurs/1"
Removes all authors
curl -s -D - -X DELETE "http://localhost:9998/myapp/biblio/auteurs"
Adds an author
curl -s -D - -H "Accept: application/json" \
-H "Content-type: application/json" \
-X POST \
-d '{"nom":"John","prenom":"Smith","biographie":"My life"}' \
"http://localhost:9998/myapp/biblio/auteurs/"