0

Im using Jersey for jax-rs and I have two methods in my Resource

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/Updates")
public FileBrowserLoadResult getUpdates() {
    return getUpdates("", "");
}

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/Updates"+"/{id: [0-9]+}{path: .*}")
public FileBrowserLoadResult getUpdates(@PathParam("id")String id, @PathParam("path") String path) {
    return null;
}

Is it possible to combine the path so I don't have to implement two methods? The Parameter can be empty but I don't know how to solve it.

Qwerky
  • 18,217
  • 6
  • 44
  • 80
Ser Yoga
  • 466
  • 1
  • 6
  • 18

1 Answers1

1

I think this should work

@Path("/Updates{id : (/[0-9]+)?}{path : .*}")

But I haven't tested

joaonlima
  • 618
  • 5
  • 15