@Path("{plugin}/{resource}")
public PluginRestResource getResource(@PathParam("plugin") final String pluginId, @PathParam("resource") String resource) {
final Set<PluginRestResource> pluginResources = pluginRestResources.get(pluginId);
if (pluginResources == null || pluginResources.size() == 0)
throw new NotFoundException();
System.out.println("pluginId = " + pluginId + ", resource = " + resource);
if (!resource.startsWith("/"))
resource = "/" + resource;
for (PluginRestResource pluginRestResource : pluginResources) {
System.out.println("Checking " + pluginRestResource);
Path pathAnnotation = Resource.getPath(pluginRestResource.getClass());
System.out.println("PathAnnotation: " + pathAnnotation);
if (pathAnnotation != null && pathAnnotation.value() != null) {
String pathAnnotationString = pathAnnotation.value();
if (!pathAnnotationString.startsWith("/"))
pathAnnotationString = "/" + pathAnnotationString;
if (pathAnnotationString.equals(resource)) {
System.out.println("Returning " + pluginRestResource);
return pluginRestResource;
}
}
}
throw new NotFoundException();
}