Code review - Issue 67146: Sling Path Resolvable Resource Typeshttps://codereview.appspot.com/2009-06-04T09:54:15+00:00rietveld
Message from unknown
2009-06-03T11:13:33+00:00ianbostonurn:md5:2e00b3e87d45a0fa7e0aed8e85f30f4d
Message from fmeschbe@gmail.com
2009-06-03T13:19:59+00:00fmeschbeurn:md5:77fcafa05d0ea343d0361200c8b00b66
Looks basically good to me. Except that I consider the resource type of NonExistingResources fixed.
So either we just return a SyntheticResource using the generated resource type or we create a NonExistingResource whose resource super type is set to the generated resource type.
http://codereview.appspot.com/67146/diff/1/2
File bundles/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java (right):
http://codereview.appspot.com/67146/diff/1/2#newcode28
Line 28: String resourceURI, String resourceType) {
The resource type of a NonExistingResource is not intended to be different from sling:nonexisting. This might break existing applications.
http://codereview.appspot.com/67146/diff/1/5
File bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java (right):
http://codereview.appspot.com/67146/diff/1/5#newcode240
Line 240: res = new NonExistingResource(this, absRealPath, getPathResourceType(absRealPath));
Considering the resource type of non existing resources should be fixed, I would do something like this:
String type = getPathResourceType(absRealPath);
if (type == null) {
res = new NonExistingResource(this, absRealPath);
} else {
res = new SyntheticResource(this, absRealPath, type);
}
Alternatively instead of creating a plain SyntheticResource it could also be:
res = new NonExistingResource(this, absRealPath) {
public String getResourceSuperType() {
return type;
}
};
Message from unknown
2009-06-03T17:00:14+00:00ianbostonurn:md5:cdce29793d21e5c186f8841d207c6479
Message from unknown
2009-06-03T21:03:48+00:00ianbostonurn:md5:e5486b17cfe5f02a6947c0995e0dff59
Message from unknown
2009-06-04T09:54:15+00:00ianbostonurn:md5:5fdbd0fa23064afd22b02198bd58492c