Tagged: pathsegment

@MatrixParam with Jersey

With, currently the newest (, GlassFish, @MatrixParam doesn’t work as expected.

http://.../path1/path2;value={value} does work,
http://.../path1;value={value}/path2 does not work.

And it’s still open.

One of workarounds is, as stated at Inheritance of duplicate @MatrixParam, using PathSegment along with @PathParam.

@Path("/{path1: path1}/path2")
public Resource read(
    @PathParam("path1") final PathSegment path1) {

    assert path1 != null;
    assert path1.getPath().equals("path1");

    final MultivaluedMap<String, String> matrixParameters = path1.getMatrixParameters();
    final List<String> values = matrixParameters.get("value");
    final String value = matrixParameters.getFirst("value");

    // ...