Jin Kwon
Jin Kwon

Reputation: 21978

How can I get PathSegment for the root @Path

With following resource class,

@Path("/cities")
public class CitiesResource {

    public Response read(
        @PathParam("???") final PathSegment path) {

        // ...
    }
}

How can I get a PathSegment for the root @Path("/cities")?

Upvotes: 1

Views: 39

Answers (1)

Paul Samsotha
Paul Samsotha

Reputation: 208984

You could get all the PathSegments from UriInfo.getPathSegments()

@GET
public String read(@Context UriInfo info) {
    List<PathSegment> segments = info.getPathSegments();
}

Upvotes: 1

Related Questions