java - Jersey - The requested resource (Not Found) is not available -
it seems settings try doesn't work access methods in class. keep getting 404 not found. web.xml file:
<servlet> <servlet-name>restful web service</servlet-name> <servlet-class>com.sun.jersey.spi.container.servlet.servletcontainer</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>restfulexample.status</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>restful web service</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
and java file inside src/main/java:
package restfulexample.status; import javax.ws.rs.*; import javax.ws.rs.core.mediatype; @path("v1/status") public class v1_status { @get @produces(mediatype.text_plain) public string returntitle(){ return "java restful api"; } }
could me, @path("v1/status")
not missing slash? @path("/v1/status")
.
update
just hit me: url-pattern in web.xml missing asterisk. change to:
<servlet-mapping> <servlet-name>restful web service</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>
Comments
Post a Comment