[英]URL pattern in web xml and Restful path
I have Restful service, in web.xml 我在web.xml中拥有Restful服务
< url-pattern >/*< / url-pattern > <网址模式> / * </网址模式>
And in my Root class, 在我的根班,
@Path("")
I'm using embedded jetty server, and giving context path. 我正在使用嵌入式码头服务器,并提供上下文路径。
If I try to access the resource with 如果我尝试使用
http://localhost:1212/context
Its showing error, but if I use 它显示错误,但是如果我使用
http://localhost:1212/context/
Its working, how to solve this, I want my target URL as 它的工作原理,如何解决这个问题,我希望目标网址为
http://localhost:1212/context
I cant empty my context 我不能清空我的上下文
If context
is the root of your application localhost:1212/context
is not a valid URL into your service resource (REST) as it has to start with /
如果
context
是应用程序的根目录,则localhost:1212/context
不是进入服务资源(REST)的有效URL,因为它必须以/
开头
Make localhost:1212
the root of your application and /context
your resource name. 将
localhost:1212
设为应用程序的根目录,并/context
您的资源名称。 But I assume this collides with other plans you have? 但是我认为这会与您的其他计划相冲突吗?
You could configure nginx/apache/tomcat or similar to rewrite the url though. 您可以配置nginx / apache / tomcat或类似的来重写URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.