我是REST API的新手,目前我正在开发一个项目,我有2个资源:
现在,我需要创建下面给出的2个资源类或单个资源类。
@Path("/v1/projects")
public interface ProjectResource {
@POST
public Respone add(Project project)
@DELETE
public Respone delete(Project project)
@PUT
public Respone update(Project project)
}
@Path("/v1/projects/{projectId}/client")
public interface ClientResource {
@POST
public Respone add(Client client)
@DELETE
public Respone delete(Client client)
@PUT
public Respone update(Client client)
}
或者包含所有方法的单个资源类
@Path("/v1/projects")
public interface ProjectResource {
@POST
public Respone add(Project project)
@DELETE
public Respone delete(Project project)
@PUT
public Respone update(Project project)
@Path("/{projectId}/client")
@POST
public Respone add(Client client)
@Path("/{projectId}/client")
@DELETE
public Respone delete(Client client)
@Path("/{projectId}/client")
@PUT
public Respone update(Client client)
}