我是JAVA RESTEasy服务的新手,我按照以下URL创建了JAVA RESTEasy服务
http://karanbalkar.com/2013/09/tutorial-54-getting-started-with-resteasy-using-eclipse/
但我收到以下错误
HTTP Status 404 - /test/dateservice/getdate
type Status report
message /test/dateservice/getdate
description The requested resource is not available.
Apache Tomcat/8.0.33
web.xml代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>test</display-name>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
</web-app>
网络服务类代码
package test_pack;
import java.util.Calendar;
import java.util.Date;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("dateservice")
public class todService
{
@GET
@Path("getdate")
@Produces(MediaType.TEXT_HTML)
public Response getDate()
{
System.out.println(">>>>>>>>>>>>>>>>>>>>>Inside getDate");
String date = null;
Date currentDate = Calendar.getInstance().getTime();
date = currentDate.toString();
System.out.println("return>>>>>>>>>>>>>>"+Response.status(200).entity(date).build());
return Response.status(200).entity(date).build();
}
}
我正在使用以下jar文件
我使用以下网址
运行此操作http://localhost:8080/test/dateservice/getdate
我错过了什么?