Hi,
Further on this.
Where the url does not contain an extension (eg /_user/private/test1 )
the internal redirect/proxy works, So it works perfectly for a
curl -F"test=newnode" -u admin
http://localhost:8080/_user/private/test1/asdasd/asdasd/asdasd
resulting in creating a node at /_private/D0/33/E2/admin/test1/asdasd/
asdasd and setting the property test.
However, if the url contains an extension, then a 302 is generated
from a streaming servlet, as the target node /_private/D0/33/E2/admin/
test1/asdasd/asdasd doesnt have content subnode... so cant stream.
I think the problem is as a result of the JcrResourceResolver2
resolution process (when combined with my incorrect impl), which sets
the ResourcePathInfo to the "" as the resolver path is the same as the
request path (ie no path info).... so no extension....hence the
streaming servlet.
in my ResourceProvider I am doing.
public Resource getResource(ResourceResolver resourceResolver,
String path) {
// path is /_user/private/test1/asdasd/asdasd/asdasd.html
if (path.startsWith(getBasePath())) {
Session session = resourceResolver.adaptTo(Session.class);
String userId = session.getUserID();
String resourcePath = getResourcePath(userId, path);
// eg /_private/D0/33/E2/admin/test1/asdasd/asdasd
if (resourcePath != null) {
Resource resource = resourceResolver.resolve(resourcePath);
// a JcrNodeResource with metadata sling.resolutionPath=/
_private/D0/33/E2/admin/test1/asdasd/asdasd/asdasd,
sling.resolutionPathInfo=.html
return resource;
}
} else {
LOGGER.info("Base Path doesnt match ");
}
return null;
}
Although all of this looks correct to me, I suspect I just should not
be doing it this way... any suggestions ?
Ian
On 21 May 2009, at 16:03, Ian Boston wrote:
Hi,
Is it possible to internally Proxy an existing Sling Resource from
another ResourceProvider ?
eg
I have a PrivateResourceProvider that matches /_user/private
From that it builds a path based on the logged in user and the rest
of the url
eg
/_private/A3/D0/33/admin
eg
/_user/private/test1.html
results in
/_private/A3/D0/33/admin/test1.html
at that point I would like to internally get hold of the resource
for /_private/A3/D0/33/admin/test1.html and return with that from
the PrivateResourceProvider so that it handles everything. But, I
get an external redirect (302) to _private/A3/D0/33/admin/test1.html
Ian