0

我想在 URL 上有两个资源: /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();
     }
 }
4

1 回答 1

0

Jersey won't allow you to have two files share a common prefix, if one is using the prefix as an entire resource url.

So you can move both methods inside the same file, or have /apps be something else like /apps/list

于 2013-08-26T23:14:20.570 回答