Java 灰熊球衣-仅@Path(“/”起作用

Java 灰熊球衣-仅@Path(“/”起作用,java,jersey,grizzly,Java,Jersey,Grizzly,我尝试在Grizzly(2.2.21)服务器上使用HTTPS和Basic Auth运行Jersey(1.17)资源,并使除资源之外的所有内容都正常工作 @Path("/") public class Helloworld { @GET public String helloworld2() { return "asdf2"; } @Path("helloworld") @GET public String helloworld(

我尝试在Grizzly(2.2.21)服务器上使用HTTPS和Basic Auth运行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";
   }
}

在这两种情况下,我得到404在Firebug的每一个请求

有人有解决办法吗? Thx

编辑:

要创建服务器等,我使用以下示例代码(不带服务器信任库):

添加
注册.addMapping(“/*”)到我的初始化代码工作


非常感谢alexey

您是否尝试过查询localhost:port/helloworld/helloworld?(Ed-当然问题中给出了你们的第一个版本…@Fildor使用我得到的第一个版本:localhost:port/helloworld/helloworld->“asdf2”localhost:port/helloworld/helloworld/->404 localhost:port/helloworld/helloworld/something->“asdf2”请分享本网站的注册/初始化部分code@geozwey请尝试将此行添加到初始化代码:registration.addMapping(“/*”);
@Path("/helloworld")
public class Helloworld {

   @GET
   public String helloworld() {
      return "asdf";
   }
}