I have created a simple restful web service based on some examples and built it into a .war file(project structure has web.xml under WEB-INF), deploy it on glassfish ang get a 404 not found error when i try to call it. My class containing the service is :
import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; /** * Created by Nikos Kritikos on 10/22/2015. */ @Path("/decks") public class HS_Services { @Path("sayHello/{name}") @GET public String doSayHello(@PathParam("name") String name) { return "Hello there "+name; } } my web.xml is this :
<servlet> <servlet-name>HSRestServices</servlet-name> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>HSRestServices</servlet-name> <url-pattern>/hsrest/*</url-pattern> </servlet-mapping> i try to call it with http://localhost:8080/HSRestServices/hsrest/decks/sayHello/Nikos but i get 404 from glassfish.. Any help would be much appreciated, thank you.
@Controllerto yourHS_Servicesclass to tell Spring that is web controller