Dropwizard为部分注册端点发回404 Not Found

时间:2017-03-07 07:47:35

标签: dropwizard

我有一个公开CRUD端点的简单资源。

@Path("/stores/{store-id}/register")
@Produces(MediaType.APPLICATION_JSON)
public class RegisterResource {

@GET
@Path("/{register-id}")
public Response getRegisterById(@PathParam("store-id") Long storeId, @PathParam("register-id") Long registerId) { impl }

@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response save(RegisterDTO registerDto, @PathParam("store-id") Long storeId, @Context UriInfo uriInfo) { impl }

@PUT
@Path("/{register-id}")
@Consumes(MediaType.APPLICATION_JSON)
public Response update(RegisterDTO registerDto, @PathParam("store-id") Long storeId, @PathParam("register-id") Long registerId) { impl }

@DELETE
@Path("/{register-id}")
public Response delete(@PathParam("store-id") Long storeId, @PathParam("register-id") Long registerId) { impl }

}

Dropwizard成功注册我的资源:

INFO  [2017-03-07 07:03:49,765] io.dropwizard.jersey.DropwizardResourceConfig: The following paths were found for the configured resources:

POST    /stores/{store-id}/register (api.resources.RegisterResource)
DELETE  /stores/{store-id}/register/{register-id} (api.resources.RegisterResource)
GET     /stores/{store-id}/register/{register-id} (api.resources.RegisterResource)
PUT     /stores/{store-id}/register/{register-id} (api.resources.RegisterResource)

仅处理POST请求。当我发送GET / PUT / DELETE请求时 - 我收到404 Not Found。没有抛出/记录异常。 还有两个有趣的事实: 1)我有一个检查授权标头的过滤器。除了POST之外,它不会记录任何请求。 2)我将传入的请求记录在我资源的每个方法的第一个语句中。但只记录POST请求。

最有趣的事实是,我一天前,一切都很好。无法弄清问题在哪里......我将不胜感激任何建议。

0 个答案:

没有答案