[英]why jetty:run doesn't work with resteasy java project?
web.xml: web.xml中:
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
<init-param>
<javaee:param-name>javax.ws.rs.Application</javaee:param-name>
<javaee:param-value>com.googlecode.common.remote.pool.CommonRemotePoolApplication
</javaee:param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/service</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
then I had 然后我有
@Path("object")
public class ResourcePoolService {
@GET
@Path("borrow")
@Produces(MediaType.APPLICATION_JSON)
but after I use jetty: run to start the web. 但在我使用jetty之后:运行以启动网络。 then I get http://web.cn:8080/common-remote-pool/service/object/borrow doesn't work. 然后我得到http://web.cn:8080/common-remote-pool/service/object/borrow不起作用。 the error is: Could not find resource for relative : /object/borrow of full path: http://web.cn:8080/common-remote-pool/service/object/borrow . 错误是:无法找到相对的资源:/ object / borrow of full path: http ://web.cn:8080 / common-remote-pool/service/object/borrow。
but I can get the index.jsp: http://web.cn:8080/common-remote-pool 但是我可以得到index.jsp: http ://web.cn:8080 / common-remote -pool
why? 为什么? how to fix it. 如何解决它。
Your paths are missing slashes. 你的路径缺少斜线。
@Path("/object")
public class ResourcePoolService {
@GET
@Path("/borrow")
@Produces(MediaType.APPLICATION_JSON)
public Foo borrow() {
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.