baseUri(null);
relativeTo = null;
}
private void initPaths() {
UriInfo uriInfo = context.getUriInfo();
resourcePath = null;
subResourcePath = null;
// we need to determine the path of the resource, and the path of the
// sub-resource method
// (if it exists)
List<String> matchedURIs = uriInfo.getMatchedURIs(false);
if (matchedURIs.size() == 1) {
// if we have only one matched URI, it's a root resource without a
// sub-resource method
resourcePath = matchedURIs.get(0);
subResourcePath = null;
} else {
// we have more than one matched URI. It means we went through at
// least one sub-resource
// (locator or method).
// We compare the number of matched resources against the number of
// matched URI's to
// determine if the the invoked method is a resource method or a
// sub-resource method.
// If the number of matched URI's is the same as the number of
// matched resources, then
// we invoked a resource method.
// If the number of matched URI's is greater than the number of
// matched resources, then
// we invoked a sub-resource method.
List<Object> matchedResources = uriInfo.getMatchedResources();
if (matchedURIs.size() == matchedResources.size()) {
// the number of matched URI's is the same as the number of
// matched resources - this
// means we invoked a resource method
resourcePath = matchedURIs.get(0);