I have this REST resource:
@GET
@Path("{business},{year},{sample}")
@Produces(MediaType.APPLICATION_JSON)
public Response getSample(
@PathParam("business") String business,
@PathParam("year") String year,
@PathParam("sample") String sampleId {
Sample sample = dao.findSample(business, year, sampleId);
return Response.ok(sample).build();
}
sample
param can contain slash character: 6576/M982
, for instance.
I'm calling it with http://ip:port/samples/2000,2006,6576/M982
but does not work, obviously.
I have also tried with http://ip:port/samples/2000,2006,6576%2FM982
, encoding the slash as %2F
, but doesn't work either, it doesn't reach the endpoint.
EDIT
I'm using Retrofit to call the endpoint and I do this:
@GET("/samples/{business},{year},{sampleId}")
Observable<Sample> getSampleById(
@Path("business") String business,
@Path("year") String year,
@Path(value = "sampleId", encoded = true) String sampleId);
With encoded = true
, but still not working.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…