我尝试使用HTTPS和Basic Auth在Grizzly(2.2.21)服务器上运行Jersey(1.17)资源,并获得除资源之外的所有内容。
@Path("/")
public class Helloworld {
@GET
public String helloworld2() {
return "asdf2";
}
@Path("helloworld")
@GET
public String helloworld() {
return "asdf";
}
}是的,这只是Helloworld的例子,它仍然让我抓狂。我可以访问localhost:port/,它工作得很好,但是localhost:port/somethingother也返回"asdf2“。尤其是localhost:port/helloworld也返回"asdf2“。
我也试过
@Path("/")
public class Helloworld {
@GET
@Path("/helloworld")
public String helloworld() {
return "asdf";
}
}和
@Path("/helloworld")
public class Helloworld {
@GET
public String helloworld() {
return "asdf";
}
}在这两种情况下,每次请求我都会在Firebug中获得404。
有人有解决方案吗?Thx
编辑:
为了创建服务器等,我使用以下示例代码(没有服务器信任库):https://svn.java.net/svn/jersey~svn/trunk/jersey/samples/https-clientserver-grizzly/src/main/java/com/sun/jersey/samples/https_grizzly/
发布于 2013-07-24 23:25:07
将registration.addMapping("/*");添加到我的初始化代码中起作用了。
非常感谢alexey
https://stackoverflow.com/questions/16106676
复制相似问题