代码之家  ›  专栏  ›  技术社区  ›  PeterMmm

resteay如何解决@path冲突

  •  4
  • PeterMmm  · 技术社区  · 15 年前

    考虑上面的代码

    @Path("a")
    @Produces("text/plain")
    public class A {
    
        @GET
        @Path("a")
        public String getA() {
            return "a";
        }
    
        @GET
        @Path("a")
        public String getB() {
            return "b";
        }
    }
    

    请求 http://host/a/a 我总是得到“B”。

    选择批准方法的策略是什么? 有没有办法了解到不同资源的多条路径?

    1 回复  |  直到 15 年前