From 71793635d32d50427bc4165b29b39aaabec3d743 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:55:46 +0100 Subject: [PATCH] CleanUp Code --- RestEasy Example/pom.xml | 3 +- .../baeldung/client/ServicesInterface.java | 1 - .../main/java/com/baeldung/model/Movie.java | 2 -- .../com/baeldung/server/MovieCrudService.java | 17 ++++------- .../com/baeldung/server/RestEasyServices.java | 8 ----- .../src/main/resources/schema1.xsd | 29 ------------------- .../src/main/webapp/WEB-INF/web.xml | 3 -- .../java/baeldung/client/RestEasyClient.java | 7 ----- .../baeldung/server/RestEasyClientTest.java | 1 - 9 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 RestEasy Example/src/main/resources/schema1.xsd delete mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 6935238d91..9c890da2b7 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -36,7 +36,7 @@ - + org.jboss.resteasy jaxrs-api @@ -101,5 +101,4 @@ - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 8898b83483..22669717a8 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,7 +1,6 @@ package com.baeldung.client; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 805ba95209..56ba766ff4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,11 +1,9 @@ - package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "movie", propOrder = { "actors", diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 29226aa0e0..bbb3b1e953 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,7 +1,6 @@ package com.baeldung.server; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -11,23 +10,21 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; - @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbID)){ - return inventory.get(imdbID); + if(inventory.containsKey(imdbId)){ + return inventory.get(imdbId); }else return null; } @@ -70,16 +67,16 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbID)){ + if (null==inventory.get(imdbId)){ return Response.status(Response.Status.NOT_FOUND) .entity("Movie is not in the database.\nUnable to Delete").build(); } - inventory.remove(imdbID); + inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } @@ -93,6 +90,4 @@ public class MovieCrudService { } - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 8c57d2c9b4..7726e49f38 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,19 +1,11 @@ package com.baeldung.server; - import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; -import java.util.Arrays; import java.util.HashSet; import java.util.Map; import java.util.Set; -/** - * Created by Admin on 29/01/2016. - */ - - - @ApplicationPath("/rest") public class RestEasyServices extends Application { diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd deleted file mode 100644 index 0d74b7c366..0000000000 --- a/RestEasy Example/src/main/resources/schema1.xsd +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index f70fdf7975..1e7f64004d 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,12 +5,9 @@ RestEasy Example - resteasy.servlet.mapping.prefix /rest - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java deleted file mode 100644 index b474b3d4f8..0000000000 --- a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package baeldung.client; - -/** - * Created by Admin on 29/01/2016. - */ -public class RestEasyClient { -} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index b6a2e2a0c1..faa39e0199 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -10,7 +10,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; import org.junit.Test; - import javax.naming.NamingException; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder;