Minor Bugfix
This commit is contained in:
@@ -14,7 +14,7 @@ public interface ServicesInterface {
|
||||
@GET
|
||||
@Path("/getinfo")
|
||||
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
|
||||
Movie movieByImdbID(@QueryParam("imdbID") String imdbID);
|
||||
Movie movieByImdbId(@QueryParam("imdbId") String imdbId);
|
||||
|
||||
|
||||
@GET
|
||||
@@ -37,7 +37,7 @@ public interface ServicesInterface {
|
||||
|
||||
@DELETE
|
||||
@Path("/deletemovie")
|
||||
Response deleteMovie(@QueryParam("imdbID") String imdbID);
|
||||
Response deleteMovie(@QueryParam("imdbId") String imdbID);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
"country",
|
||||
"director",
|
||||
"genre",
|
||||
"imdbID",
|
||||
"imdbId",
|
||||
"imdbRating",
|
||||
"imdbVotes",
|
||||
"language",
|
||||
@@ -36,7 +36,7 @@ public class Movie {
|
||||
protected String country;
|
||||
protected String director;
|
||||
protected String genre;
|
||||
protected String imdbID;
|
||||
protected String imdbId;
|
||||
protected String imdbRating;
|
||||
protected String imdbVotes;
|
||||
protected String language;
|
||||
@@ -173,27 +173,27 @@ public class Movie {
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera il valore della propriet� imdbID.
|
||||
* Recupera il valore della propriet� imdbId.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getImdbID() {
|
||||
return imdbID;
|
||||
public String getImdbId() {
|
||||
return imdbId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imposta il valore della propriet� imdbID.
|
||||
* Imposta il valore della propriet� imdbId.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public void setImdbID(String value) {
|
||||
this.imdbID = value;
|
||||
public void setImdbId(String value) {
|
||||
this.imdbId = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -540,7 +540,7 @@ public class Movie {
|
||||
", country='" + country + '\'' +
|
||||
", director='" + director + '\'' +
|
||||
", genre='" + genre + '\'' +
|
||||
", imdbID='" + imdbID + '\'' +
|
||||
", imdbId='" + imdbId + '\'' +
|
||||
", imdbRating='" + imdbRating + '\'' +
|
||||
", imdbVotes='" + imdbVotes + '\'' +
|
||||
", language='" + language + '\'' +
|
||||
@@ -564,14 +564,14 @@ public class Movie {
|
||||
|
||||
Movie movie = (Movie) o;
|
||||
|
||||
if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false;
|
||||
if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false;
|
||||
return title != null ? title.equals(movie.title) : movie.title == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = imdbID != null ? imdbID.hashCode() : 0;
|
||||
int result = imdbId != null ? imdbId.hashCode() : 0;
|
||||
result = 31 * result + (title != null ? title.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MovieCrudService {
|
||||
@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***");
|
||||
|
||||
@@ -40,12 +40,12 @@ public class MovieCrudService {
|
||||
|
||||
System.out.println("*** Calling addMovie ***");
|
||||
|
||||
if (null!=inventory.get(movie.getImdbID())){
|
||||
if (null!=inventory.get(movie.getImdbId())){
|
||||
return Response.status(Response.Status.NOT_MODIFIED)
|
||||
.entity("Movie is Already in the database.").build();
|
||||
}
|
||||
|
||||
inventory.put(movie.getImdbID(),movie);
|
||||
inventory.put(movie.getImdbId(),movie);
|
||||
|
||||
return Response.status(Response.Status.CREATED).build();
|
||||
}
|
||||
@@ -58,11 +58,11 @@ public class MovieCrudService {
|
||||
|
||||
System.out.println("*** Calling updateMovie ***");
|
||||
|
||||
if (null==inventory.get(movie.getImdbID())){
|
||||
if (null==inventory.get(movie.getImdbId())){
|
||||
return Response.status(Response.Status.NOT_MODIFIED)
|
||||
.entity("Movie is not in the database.\nUnable to Update").build();
|
||||
}
|
||||
inventory.put(movie.getImdbID(),movie);
|
||||
inventory.put(movie.getImdbId(),movie);
|
||||
return Response.status(Response.Status.OK).build();
|
||||
|
||||
}
|
||||
@@ -70,7 +70,7 @@ 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 ***");
|
||||
|
||||
|
||||
@@ -5,47 +5,12 @@
|
||||
|
||||
<display-name>RestEasy Example</display-name>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
|
||||
</listener-class>
|
||||
</listener>
|
||||
|
||||
<description>RestEasy Example</description>
|
||||
|
||||
<context-param>
|
||||
<param-name>webAppRootKey</param-name>
|
||||
<param-value>RestEasyExample</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<!-- this need same with resteasy servlet url-pattern -->
|
||||
<!-- needed only if you want prepend a relative path to your services -->
|
||||
<context-param>
|
||||
<param-name>resteasy.servlet.mapping.prefix</param-name>
|
||||
<param-value>/rest</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>resteasy-servlet</servlet-name>
|
||||
<servlet-class>
|
||||
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
|
||||
</servlet-class>
|
||||
<init-param>
|
||||
<param-name>javax.ws.rs.Application</param-name>
|
||||
<param-value>com.baeldung.server.RestEasyServices</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>resteasy-servlet</servlet-name>
|
||||
<url-pattern>/rest/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
|
||||
</web-app>
|
||||
Reference in New Issue
Block a user