```
MovieFacadeREST
package com.mycompany.movieplex7.rest;
import com.mycompany.movieplex7.entities.Movie;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
*
- @author justme
*/
@Stateless
@Path("movie")
public class MovieFacadeREST extends AbstractFacade {
@PersistenceContext(unitName = "movieplex7PU")
private EntityManager em;
public MovieFacadeREST() {
super(Movie.class);
}
@POST
@Override
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void create(Movie entity) {
super.create(entity);
}
@PUT
@Path("{id}")
@Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public void edit(@PathParam("id") Integer id, Movie entity) {
super.edit(entity);
}
@DELETE
@Path("{id}")
public void remove(@PathParam("id") Integer id) {
super.remove(super.find(id));
}
@GET
@Path("{id}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Movie find(@PathParam("id") Integer id) {
return super.find(id);
}
@GET
@Override
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List findAll() {
return super.findAll();
}
@GET
@Path("{from}/{to}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public List findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
return super.findRange(new int[]{from, to});
}
@GET
@Path("count")
@Produces(MediaType.TEXT_PLAIN)
public String countREST() {
return String.valueOf(super.count());
}
@Override
protected EntityManager getEntityManager() {
return em;
}
}
ApplicationConfig
package com.mycompany.movieplex7.rest;
import java.util.Set;
import javax.ws.rs.core.Application;
/**
*
- @author justme
*/
@javax.ws.rs.ApplicationPath("webresources")
public class ApplicationConfig extends Application {
@Override
public Set> getClasses() {
Set> resources = new java.util.HashSet<>();
addRestResourceClasses(resources);
return resources;
}
/**
- Do not modify addRestResourceClasses() method.
- It is automatically populated with
- all resources defined in the project.
- If required, comment out calling this method in getClasses().
*/
private void addRestResourceClasses(Set> resources) {
resources.add(com.mycompany.movieplex7.rest.MovieFacadeREST.class);
resources.add(com.mycompany.movieplex7.rest.SalesFacadeREST.class);
resources.add(com.mycompany.movieplex7.rest.ShowTimingFacadeREST.class);
resources.add(com.mycompany.movieplex7.rest.TheaterFacadeREST.class);
resources.add(com.mycompany.movieplex7.rest.TimeslotFacadeREST.class);
resources.add(org.glassfish.movieplex7.json.MovieReader.class);
resources.add(org.glassfish.movieplex7.json.MovieWriter.class);
}
}
Pom.xml
4.0.0
```
com.mycompanymovieplex71.0-SNAPSHOTwarmovieplex7${project.build.directory}/endorsedUTF-8org.eclipse.persistenceeclipselink2.5.2providedorg.eclipse.persistenceorg.eclipse.persistence.jpa.modelgen.processor2.5.2providedjavaxjavaee-web-api7.0providedorg.apache.maven.pluginsmaven-compiler-plugin3.11.7${endorsed.dir}org.apache.maven.pluginsmaven-war-plugin2.3falseorg.apache.maven.pluginsmaven-dependency-plugin2.6validatecopy${endorsed.dir}truejavaxjavaee-endorsed-api7.0jar
```
I have already tried this example three times but everytime its getting stuck with same problem...
Next the JSF2.2 fileuploadexample is also not working I have tried atleast twice once with my own code and second time I used your code as mentioned over here plz help me with both the issues
web.xml <?xml version="1.0" encoding="UTF-8"?>
booking.xhtml
```Pick a Movie