在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">
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.application.api</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
在我的控制器中,我正在尝试使用
获取数据$http.get(URI+"BoatAPI/fetchBoatingTypes").then(
function(response){
},function(response){ });
在我的API类
中@Path("BoatAPI")
public class BoatAPI{
@GET
@Path("fetchBoatingTypes")
@Produces(MediaType.Application.JSON)
Public Response fetchBoatingTypes() throws Exception{
return response;
}
和URI为http://localhost:5555/HouseBoats/api/
当我尝试在我的页面中获取详细信息时,我收到错误:
http://localhost:5555/HouseBoats/api/BoatAPI/fetchBoatingTypes 404(未找到)。
你能解释一下我收到错误的原因吗?