0

I am using Jersey to build a RESTful Web API and I am running into some problems.

I used Jersey archive 1.19 and I corrected the error of servlet-class and param-name mentioned in previous question. But the class not found still exists.

This time the jsp page I created is able to visit with no 404 error. I did not implement any content to it.

Below is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>AllegiantWS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey REST 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>allegiantWS.rest.resources</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

</web-app>

My project name is AllegiantWS. What could be wrong?

Community
  • 1
  • 1
jsh6303
  • 2,010
  • 3
  • 24
  • 50

1 Answers1

0

url-pattern and @PATH seem to be in consistent:

<url-pattern>/api/*</url-pattern>

This tells container that all requests with http://[Hostname]/api to be redirected to this servlet.

@Path("/v1/status")

The rest controller will handle requests of form http://[Hostname]/v1/status

quintin
  • 812
  • 1
  • 10
  • 35