mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-13 17:11:49 +00:00
refactor(DevWeb): Remove unused class
This commit is contained in:
@@ -1,34 +0,0 @@
|
|||||||
package uppa.project.utils;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import uppa.project.database.dao.DAO;
|
|
||||||
import uppa.project.database.dao.DAOException;
|
|
||||||
import uppa.project.database.dao.jpa.DAO_JPA_Game;
|
|
||||||
import uppa.project.database.pojo.Game;
|
|
||||||
|
|
||||||
public class GameProvider {
|
|
||||||
|
|
||||||
private static DAO<Game> gameDAO;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
gameDAO = new DAO_JPA_Game();
|
|
||||||
} catch (DAOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static HashMap<Integer, Game> games = new HashMap<>();
|
|
||||||
|
|
||||||
public static Game getGame(int gameId) throws DAOException {
|
|
||||||
if (!games.containsKey(gameId)) {
|
|
||||||
Game game = gameDAO.findById(gameId);
|
|
||||||
games.put(gameId, game);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (games.get(gameId) == null) {
|
|
||||||
throw new DAOException("Game not found");
|
|
||||||
}
|
|
||||||
return games.get(gameId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* RequestUtils.java, 20/03/2024
|
|
||||||
* UPPA M1 TI 2023-2024
|
|
||||||
* Pas de copyright, aucun droits
|
|
||||||
*/
|
|
||||||
|
|
||||||
package uppa.project.utils;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classe utilitaire pour les requêtes HTTP
|
|
||||||
*
|
|
||||||
* @author Kevin Mitressé
|
|
||||||
* @author Lucàs Vabre
|
|
||||||
*/
|
|
||||||
public class HttpRequestUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Récupère le corps de la requête HTTP
|
|
||||||
*
|
|
||||||
* @param request la requête HTTP
|
|
||||||
* @return le corps de la requête
|
|
||||||
* @throws IOException en cas de problème
|
|
||||||
*/
|
|
||||||
public static String getRequestBody(HttpServletRequest request) throws IOException {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
BufferedReader reader = request.getReader();
|
|
||||||
String line;
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
sb.append(line);
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user