泽西岛没有找到我的资源与子网址

时间:2013-08-26 22:23:55

标签: java spring http rest jersey

我希望在网址上有两个资源:/apps/apps/runs

所以,我创建了如下所示的资源。我使用Spring进行对象注入。当我使用这种方式时,我会在404 error for HTTP get requests上获得/apps/runs。难道我做错了什么?

这是我的代码:

@Scope("prototype")
@Path("/apps")
public class ManufacturersResource {

    @GET
    @Produces("application/xml")
    public List<Applications> getApplications() {
        return apps.findAll();
    }
    }

 @Scope("prototype")
 @Path("/apps/runs")
 public class ManufacturersResource {

    @GET
     @Produces("application/xml")
     public List<ApplicationInstances> getApplicationInstances() {
         return appInstances.findAll();
     }
 }

1 个答案:

答案 0 :(得分:0)

如果使用前缀作为整个资源网址,泽西岛将不允许您有两个共享公共前缀的文件。

所以你可以在同一个文件中移动这两个方法,或者让/ apps成为/ apps / list

之类的东西