简体   繁体   English

如何在码头上设置泽西岛

[英]How to setup Jersey on Jetty

Here are my relevant files. 这是我的相关文件。

POM file: http://pastebin.com/ZPTWifys web.xml file: http://pastebin.com/7kd8Et6Y JAX-RS resource: http://pastebin.com/ddwDEwNK POM文件: http : //pastebin.com/ZPTWifys web.xml文件: http : //pastebin.com/7kd8Et6Y JAX-RS资源: http : //pastebin.com/ddwDEwNK

I do a mvn clean install - works fine. 我执行mvn全新安装-效果很好。 I point my browser to localhost:8080/firstjersey. 我将浏览器指向localhost:8080 / firstjersey。 I get the "Hello World" index page. 我得到了“ Hello World”索引页面。 Then I try pointing my browser to localhost:8080/firstjersey/resources/test, and I get nothing. 然后,我尝试将浏览器指向localhost:8080 / firstjersey / resources / test,但我什么也没得到。 I try localhost:8080/resources/test, and get nothing. 我尝试localhost:8080 / resources / test,却一无所获。 The problem is that I am simply unable to access my resource. 问题是我根本无法访问我的资源。 I don't know if it's even being scanned by the servlet container. 我不知道它是否正在被servlet容器扫描。 But everything in my configuration looks right. 但是我配置中的所有内容看起来都是正确的。 What's wrong? 怎么了?

I appreciate all help in advance. 我先感谢所有帮助。

Your servlet mapping should include a wildcard: 您的servlet映射应包含通配符:

<servlet-mapping>
  <servlet-name>My Servlet</servlet-name>
  <url-pattern>/resources/*</url-pattern>
</servlet-mapping>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM