Skip to content
Snippets Groups Projects
Commit 4dc6b705 authored by BRICHE Louis's avatar BRICHE Louis
Browse files

changements mineurs

parent 63e5295b
Branches
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA" serialisationVersion="2">
<checkstyleVersion>10.21.2</checkstyleVersion>
<scanScope>JavaOnly</scanScope>
<copyLibs>true</copyLibs>
<option name="thirdPartyClasspath" />
<option name="activeLocationIds" />
<option name="locations">
<list>
<ConfigurationLocation id="bundled-sun-checks" type="BUNDLED" scope="All" description="Sun Checks">(bundled)</ConfigurationLocation>
<ConfigurationLocation id="bundled-google-checks" type="BUNDLED" scope="All" description="Google Checks">(bundled)</ConfigurationLocation>
</list>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/backend/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/backend/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/projet_prog_reseau.iml" filepath="$PROJECT_DIR$/projet_prog_reseau.iml" />
</modules>
</component>
</project>
\ No newline at end of file
package fr.louis.projetprogreseau;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
@Path("/hello-world")
public class HelloResource {
@GET
@Produces("text/plain")
public String hello() {
return "Hello, World!";
}
@GET
@Produces("text/plain")
@Path("/{intVal}")
public int testValue(@PathParam("intVal") Integer value) {
return 2*value;
}
@GET
@Produces("text/plain")
@Path("/{intVal}/{intVal2}")
public int testValue(@PathParam("intVal") Integer value, @PathParam("intVal2") Integer value2) {
return value + value2;
}
}
\ No newline at end of file
package fr.louis.projetprogreseau.api;
import fr.louis.projetprogreseau.quizz.Quizz;
import fr.louis.projetprogreseau.user.User;
import fr.louis.projetprogreseau.user.Users;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.UUID;
@Path("/quiz")
public class QuizzResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Quizz getQuizz(@FormParam("userUuid") UUID userUuid) {
User user = Users.get(userUuid);
return user.getNextQuizz();
}
@GET
@Produces("text/plain")
@Path("/answer")
public String getResult(@FormParam("userUuid") UUID userUuid, @FormParam("answer") int answer) {
User user = Users.get(userUuid);
if (user == null) return " Utilisateur non trouvé";
Quizz quizz = user.getActualQuizz();
return quizz.guess(answer, user) ? "C'était la bonne réponse" : "Ce n'était pas la bonne réponse, la bonne réponse était : " + quizz.getCorreectAnswer();
}
}
......@@ -56,6 +56,11 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.13.1</version>
</dependency>
</dependencies>
<build>
......
package fr.louis.projetprogreseau;
import fr.louis.projetprogreseau.quizz.DefaultQuizz;
import fr.louis.projetprogreseau.quizz.DefaultQuiz;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;
......@@ -9,7 +9,7 @@ import jakarta.servlet.annotation.WebListener;
public class ServerStartListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
DefaultQuizz.init();
DefaultQuiz.init();
System.out.println("Application démarrée");
}
}
package fr.louis.projetprogreseau;
package fr.louis.projetprogreseau.api;
import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;
@ApplicationPath("/api")
public class HelloApplication extends Application {
public class QuizApplication extends Application {
}
\ No newline at end of file
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment