I have the below code as my restful service operation.
@GET
@UnitOfWork
@Timed(name = "get-requests")
@Path("/{referenceId}")
public Response get(@Auth @ApiParam(access = "internal") UserPrincipal user,
@ApiParam(name = "id", value = "reference ID", required = true)
@PathParam("referenceId") String id) {
return Response.ok(id).build();
}
However, I noticed if I pass in m1234;5678
, I get only m1234
returned. I tried @Path("/{referenceId:.*}")
, but it doesn't work.
I also tried use @Encode
at the top of the method to make sure the url is not decoded and then try to replace %3B
with ";" in the code. But it seems not working also.
Please note that I cannot use Spring framework. Thanks.
The
;
denotes a matrix parameter. Use@MatrixParam
to get its value.See also the answers to this question: URL matrix parameters vs. request parameters
Edit: The key of the matrix parameter would be
5678
, the value would benull
.There is a way to get achieve what you want by using
PathSegment
as the type of the parameter instead ofString
:In the body of the method, you can use
to get
m1234;5678
.