diff --git a/META-INF/context.xml b/META-INF/context.xml new file mode 100644 index 0000000000000000000000000000000000000000..b6c932da1486820abcc5036496ff75b3d4644a2a --- /dev/null +++ b/META-INF/context.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<Context> + <CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor" + sameSiteCookies="strict" /> +</Context> diff --git a/WEB-INF/WEB-INF.iml b/OLD-WEB-INF/WEB-INF.iml similarity index 100% rename from WEB-INF/WEB-INF.iml rename to OLD-WEB-INF/WEB-INF.iml diff --git a/OLD-WEB-INF/classes/DAO/IngredientDAO.class b/OLD-WEB-INF/classes/DAO/IngredientDAO.class new file mode 100644 index 0000000000000000000000000000000000000000..0d839a8ec008d34229ef7250380de2156706cdfd Binary files /dev/null and b/OLD-WEB-INF/classes/DAO/IngredientDAO.class differ diff --git a/OLD-WEB-INF/classes/Exceptions/IngredientDAOException.class b/OLD-WEB-INF/classes/Exceptions/IngredientDAOException.class new file mode 100644 index 0000000000000000000000000000000000000000..38eadd310ec06536bf238f5314e186adecb10675 Binary files /dev/null and b/OLD-WEB-INF/classes/Exceptions/IngredientDAOException.class differ diff --git a/OLD-WEB-INF/classes/Main.class b/OLD-WEB-INF/classes/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..0733ac42bec3803da2cf93d33bd7167716a81f0e Binary files /dev/null and b/OLD-WEB-INF/classes/Main.class differ diff --git a/OLD-WEB-INF/classes/POJO/Ingredient.class b/OLD-WEB-INF/classes/POJO/Ingredient.class new file mode 100644 index 0000000000000000000000000000000000000000..eef8a6b1ddfac96c8583dee1bcadbd6c19f51678 Binary files /dev/null and b/OLD-WEB-INF/classes/POJO/Ingredient.class differ diff --git a/OLD-WEB-INF/classes/POJO/Price.class b/OLD-WEB-INF/classes/POJO/Price.class new file mode 100644 index 0000000000000000000000000000000000000000..922f8d494a450fe870f510fe3e4401a9e3a65804 Binary files /dev/null and b/OLD-WEB-INF/classes/POJO/Price.class differ diff --git a/OLD-WEB-INF/classes/Servlets/DatabaseTestServlet.class b/OLD-WEB-INF/classes/Servlets/DatabaseTestServlet.class new file mode 100644 index 0000000000000000000000000000000000000000..82f4b9211548fd87f9ba396d711af478ab4c1567 Binary files /dev/null and b/OLD-WEB-INF/classes/Servlets/DatabaseTestServlet.class differ diff --git a/OLD-WEB-INF/classes/Servlets/IngredientServlet.class b/OLD-WEB-INF/classes/Servlets/IngredientServlet.class new file mode 100644 index 0000000000000000000000000000000000000000..abff83b9b9978640cf9048d278ffc91e9ed46e5b Binary files /dev/null and b/OLD-WEB-INF/classes/Servlets/IngredientServlet.class differ diff --git a/WEB-INF/src/DAO/IngredientDAO.java b/OLD-WEB-INF/src/DAO/IngredientDAO.java similarity index 100% rename from WEB-INF/src/DAO/IngredientDAO.java rename to OLD-WEB-INF/src/DAO/IngredientDAO.java diff --git a/WEB-INF/src/Exceptions/IngredientDAOException.java b/OLD-WEB-INF/src/Exceptions/IngredientDAOException.java similarity index 100% rename from WEB-INF/src/Exceptions/IngredientDAOException.java rename to OLD-WEB-INF/src/Exceptions/IngredientDAOException.java diff --git a/WEB-INF/src/Main.java b/OLD-WEB-INF/src/Main.java similarity index 100% rename from WEB-INF/src/Main.java rename to OLD-WEB-INF/src/Main.java diff --git a/WEB-INF/src/POJO/Ingredient.java b/OLD-WEB-INF/src/POJO/Ingredient.java similarity index 100% rename from WEB-INF/src/POJO/Ingredient.java rename to OLD-WEB-INF/src/POJO/Ingredient.java diff --git a/WEB-INF/src/POJO/Price.java b/OLD-WEB-INF/src/POJO/Price.java similarity index 100% rename from WEB-INF/src/POJO/Price.java rename to OLD-WEB-INF/src/POJO/Price.java diff --git a/WEB-INF/src/Servlets/DatabaseTestServlet.java b/OLD-WEB-INF/src/Servlets/DatabaseTestServlet.java similarity index 100% rename from WEB-INF/src/Servlets/DatabaseTestServlet.java rename to OLD-WEB-INF/src/Servlets/DatabaseTestServlet.java diff --git a/WEB-INF/src/Servlets/IngredientServlet.java b/OLD-WEB-INF/src/Servlets/IngredientServlet.java similarity index 100% rename from WEB-INF/src/Servlets/IngredientServlet.java rename to OLD-WEB-INF/src/Servlets/IngredientServlet.java diff --git a/OLD-WEB-INF/test-classes/DAO/IngredientDAOTest.class b/OLD-WEB-INF/test-classes/DAO/IngredientDAOTest.class new file mode 100644 index 0000000000000000000000000000000000000000..d0da616bced4ad10affaeaacd19df0aa3dda5800 Binary files /dev/null and b/OLD-WEB-INF/test-classes/DAO/IngredientDAOTest.class differ diff --git a/WEB-INF/test/DAO/IngredientDAOTest.java b/OLD-WEB-INF/test/DAO/IngredientDAOTest.java similarity index 100% rename from WEB-INF/test/DAO/IngredientDAOTest.java rename to OLD-WEB-INF/test/DAO/IngredientDAOTest.java diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3d71dcac6110a3448e7612ad1b9b500e7a55fa6f --- /dev/null +++ b/README.md @@ -0,0 +1,184 @@ +# SAÉ 4.01 - Pizzeria en REST +> Binôme +> - DELBE florian +> - MARGELY Gwendal + +# Sommaire +1. [INGREDIENTS](#ingredients) +2. [PATES](#pates-a-pizza) +3. [PIZZA](#pizza) +4. [COMMANDE](#commande) + + + +## INGREDIENTS + +### GET + +Tous les ingrédients: +```bash +curl -X GET http://localhost:8080/pizzeria/ingredients +``` + +Un seul Ingrédient: + +```bash +curl -X GET http://localhost:8080/pizzeria/ingredients/idIngredient +``` + +### POST + +ajouter un ingredient +```bash +curl -X POST http://localhost:8080/pizzeria/ingredients -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<id>","nom":"<nom>","prix":"<prix>"}' +``` + +### DELETE + +supprimer un ingredient +```bash +curl -X DELETE http://localhost:8080/pizzeria/ingredients/idIngredient -H "Autorization: Bearer <token>" +``` + +### PATCH + +modifier un ingredient + +```bash +curl -X PATCH http://localhost:8080/pizzeria/ingredients/idIngredient -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d'<newDatas>' +``` + +## PATES A PIZZA + + +### GET + +Toutes les pates: +```bash +curl -X GET http://localhost:8080/pizzeria/pates +``` + +Une seule pate: + +```bash +curl -X GET http://localhost:8080/pizzeria/pates/idPates +``` + +### POST + +ajouter une pate +```bash +curl -X POST http://localhost:8080/pizzeria/pates -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<id>","nom":"<nom>"}' +``` + +### DELETE + +supprimer une pate +```bash +curl -X DELETE http://localhost:8080/pizzeria/pates/idPates -H "Autorization: Bearer <token>" +``` + +### PATCH + +modifier une pate + +```bash +curl -X PATCH http://localhost:8080/pizzeria/pates/idPates -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d'<newDatas>' +``` + +## Pizza + + +### GET + +Toutes les pizzas: +```bash +curl -X GET http://localhost:8080/pizzeria/pizzas +``` + +Une seule pizza: + +```bash +curl -X GET http://localhost:8080/pizzeria/pizzas/idPizza +``` + +### POST + +ajouter une pizza +```bash +curl -X POST http://localhost:8080/pizzeria/pizzas -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<id>","nom":"<nom>","prix":"<prix>","pate":"{"id":"<pateID>"}","ingredients":"[{"id":"<idIngredient1>"},{"id":"<idIngredient2>"}]"}' +``` + +ajouter un ingrédient a une pizza +```bash +curl -X POST http://localhost:8080/pizzeria/pizzas/idPizza -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<idIngredient>"}' +``` + + +### DELETE + +supprimer une pizza +```bash +curl -X DELETE http://localhost:8080/pizzeria/pizzas/idPizza -H "Autorization: Bearer <token>" +``` + +supprimer un ingrédient d'une pizza +```bash +curl -X POST http://localhost:8080/pizzeria/pizzas/idPizza/idIngrédient -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<idIngredient>"}' +``` + +### PATCH + +modifier une pizza + +```bash +curl -X PATCH http://localhost:8080/pizzeria/pizzas/idPizza -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d'<newDatas>' +``` + +## COMMANDE + +### GET + +Toutes les pizzas: +```bash +curl -X GET http://localhost:8080/pizzeria/commandes +``` + +Une seule pizza: + +```bash +curl -X GET http://localhost:8080/pizzeria/commandes/idCommande +``` + +### POST + +ajouter une commande +```bash +curl -X POST http://localhost:8080/pizzeria/commandes -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<id>","utilisateur":"<nom>","prix":"<prix>","date":"{"id":"<pateID>"}","pizzas":"[{"id":"<idIngredient1>"},{"id":"<idIngredient2>"}]"}' +``` + +ajouter une pizza dans une commande +```bash +curl -X POST http://localhost:8080/pizzeria/commandes/idCommande -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d '{"id":"<idPizza>"}' +``` + +### DELETE + +supprimer une commande +```bash +curl -X DELETE http://localhost:8080/pizzeria/commandes/idCommande -H "Autorization: Bearer <token>" +``` + +supprimer une pizza d'une commande + +```bash +curl -X DELETE http://localhost:8080/pizzeria/commandes/idCommande/idPizza -H "Autorization: Bearer <token>" +``` + +### PATCH + +modifier une commande + +```bash +curl -X PATCH http://localhost:8080/pizzeria/commandes/idCommande -H "Autorization: Bearer <token>" -H "Content-Type:application/json" -H "Accept:application/json" -d'<newDatas>' +``` \ No newline at end of file diff --git a/WEB-INF/.project b/WEB-INF/.project new file mode 100644 index 0000000000000000000000000000000000000000..7cdc712008d53e8db5954156b4e96ed7d15c9d33 --- /dev/null +++ b/WEB-INF/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>pizzeria</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/WEB-INF/lib/jackson-annotations-2.14.1.jar b/WEB-INF/lib/jackson-annotations-2.14.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..e908bd3c227c750d97f2cee55f862005e2d27aff Binary files /dev/null and b/WEB-INF/lib/jackson-annotations-2.14.1.jar differ diff --git a/WEB-INF/lib/jackson-core-2.14.1.jar b/WEB-INF/lib/jackson-core-2.14.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..cc025836227e860986d604a1d763d981fc465787 Binary files /dev/null and b/WEB-INF/lib/jackson-core-2.14.1.jar differ diff --git a/WEB-INF/lib/jackson-databind-2.14.1.jar b/WEB-INF/lib/jackson-databind-2.14.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..1ac8096422b80872cf7b5f7de413ae985f5e5c6e Binary files /dev/null and b/WEB-INF/lib/jackson-databind-2.14.1.jar differ diff --git a/WEB-INF/lib/jackson-dataformat-xml-2.14.1.jar b/WEB-INF/lib/jackson-dataformat-xml-2.14.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..22266e3256af72298ab867663bbde8a271f211b1 Binary files /dev/null and b/WEB-INF/lib/jackson-dataformat-xml-2.14.1.jar differ diff --git a/WEB-INF/lib/jjwt-api-0.11.2.jar b/WEB-INF/lib/jjwt-api-0.11.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..15f236c815d33220a193cc5e3c26bab5e448683b Binary files /dev/null and b/WEB-INF/lib/jjwt-api-0.11.2.jar differ diff --git a/WEB-INF/lib/jjwt-impl-0.11.2.jar b/WEB-INF/lib/jjwt-impl-0.11.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..3594cb18f648035464f9ef3866c68de5a4f01e42 Binary files /dev/null and b/WEB-INF/lib/jjwt-impl-0.11.2.jar differ diff --git a/WEB-INF/lib/jjwt-jackson-0.11.2.jar b/WEB-INF/lib/jjwt-jackson-0.11.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..f081d3f964a9700849c56380951d679e8d5bd24b Binary files /dev/null and b/WEB-INF/lib/jjwt-jackson-0.11.2.jar differ diff --git a/WEB-INF/lib/postgresql-42.5.2.jar b/WEB-INF/lib/postgresql-42.5.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..368fd77a44406565a7e3109ed28798cd513477af Binary files /dev/null and b/WEB-INF/lib/postgresql-42.5.2.jar differ diff --git a/WEB-INF/lib/servlet-api.jar b/WEB-INF/lib/servlet-api.jar new file mode 100644 index 0000000000000000000000000000000000000000..a9f89ba3337c8e8ebbdf6e609d7a4723554d3c12 Binary files /dev/null and b/WEB-INF/lib/servlet-api.jar differ diff --git a/WEB-INF/lib/stax2-api-4.2.1.jar b/WEB-INF/lib/stax2-api-4.2.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..28c6a08f40bd37b3c98c06c84df2a03dd3e34d3d Binary files /dev/null and b/WEB-INF/lib/stax2-api-4.2.1.jar differ