[英]RestEasy web-service not able get the response using specified URL?
I am new to web-service.I am facing strange issue in RestEasy web-service. 我是Web服务的新手,我在RestEasy Web服务中面临一个奇怪的问题。 When i hitting the web-service URL , getting below error.Plase let me know where i am doing the mistake.
当我点击Web服务URL时,遇到error.Plause,请告诉我我在哪里出错。 Thanks,
谢谢,
HTTP Status 404 - Could not find resource for relative : /rest/publish of full path: http://localhost:8888/WebServiceJaskson/rest/publish
web.xml. web.xml。
<display-name>WebServiceJaskson</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>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
RestEasyService.java RestEasyService.java
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("/publish")
public class RestEasyService {
@GET
@Produces(MediaType.TEXT_HTML)
public Response getRestResponse(){
return Response.status(200).entity("<b>Rest Web Response</b>").build();
}
}
You need to add the context-param resteasy.servlet.mapping.prefix
to your web.xml. 您需要将context-param
resteasy.servlet.mapping.prefix
添加到web.xml中。
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/rest</param-value>
</context-param>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.