Skip to content
Snippets Groups Projects
Commit 27d9dfd7 authored by Theo Taccoen's avatar Theo Taccoen
Browse files

erreur bizarre de port

parent 2f35d750
Branches master
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ import java.util.logging.Logger; ...@@ -16,7 +16,7 @@ import java.util.logging.Logger;
*/ */
public class Main { public class Main {
// Base URI the Grizzly HTTP server will listen on // Base URI the Grizzly HTTP server will listen on
public static final String BASE_URI = "http://localhost:8080/api/v1"; public static final String BASE_URI = "http://localhost:8081/api/v1";
/** /**
* Starts Grizzly HTTP server exposing JAX-RS resources defined in this application. * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
...@@ -58,7 +58,7 @@ public class Main { ...@@ -58,7 +58,7 @@ public class Main {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
final HttpServer server = startServer(); final HttpServer server = startServer();
System.out.println(String.format("Jersey app started with WADL available at " System.out.println(String.format("Jersey app started with WADL available at "
+ "%sapplication.wadl\nHit enter to stop it...", BASE_URI)); + "%s\nHit enter to stop it...", BASE_URI));
System.in.read(); System.in.read();
server.shutdownNow(); server.shutdownNow();
} }
......
...@@ -10,6 +10,7 @@ import fr.ulille.iut.tva.service.TauxTva; ...@@ -10,6 +10,7 @@ import fr.ulille.iut.tva.service.TauxTva;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam; import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.QueryParam;
/** /**
* TvaRessource * TvaRessource
...@@ -34,6 +35,19 @@ public class TvaRessource { ...@@ -34,6 +35,19 @@ public class TvaRessource {
} }
} }
@GET
@Path("details/{niveauTva}")
public double getMontantTotal(@PathParam("niveauTva") String niveau, @QueryParam("somme") String value) {
try {
double s = Double.parseDouble(value);
return s + (TauxTva.valueOf(niveau.toUpperCase()).taux * s) + 2;
} catch (Exception e) {
throw new NiveauTvaInexistantException();
}
}
@GET @GET
@Path("lestaux") @Path("lestaux")
public List<InfoTauxDto> getInfoTaux() { public List<InfoTauxDto> getInfoTaux() {
......
package fr.ulille.iut.tva.service; package fr.ulille.iut.tva.service;
import jakarta.ws.rs.*; //import jakarta.ws.rs.*;
/** /**
* TauxTva * TauxTva
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment