Hello Slingers,

We are developing an application which will feature a staging concept.
That is, the user should be able to save and preview changes before
publishing them to the world.

We have read some previous posts with great interest, in particular
[1]. In that thread, Felix Meschberger suggests [2] using multiple
workspaces to achieve this. In our case, that would be a "draft"
workspace in addition to the default workspace.
(The proposition at [3] also seems interesting in this respect).

As a temporary proof-of-concept, we've hacked
SlingAuthenticationHandler to look for a "workspace" parameter in the
URL, to decide which workspace to connect to:
SlingAuthenticator#218:
String workspace = req.getParameter("workspace");
log.debug("authenticate: credentials, trying to get a session");
Session session = getRepository().login(
authInfo.getCredentials(), workspace /* was: null */);

This way, we're able to access content in the "draft" workspace by
http://localhost:8888/path/to/node?workspace=draft

But having content stored in different workspaces introduces a number
of difficulties. The first roadblock we've hit, is this:

We want to render content in the "draft" workspace with scripts stored
in the default workspace. Since only one JCR session is created per
HTTP request, we're unable to access both a node in "draft" and the
scripts stored under /apps in the default workspace. (Of course, we
could duplicate all content under /apps to both workspaces, but that
seems just ... wrong).

Looking at the different interfaces in Sling, it seems it should be
possible to implement a custom JcrResourceResolver. The Resolver would
examine the HttpRequest, and create a connection to the desired
workspace and fetch the content.
Given that this is a possible solution, how do we register our
JcrResourceResolver so that it can respond to certain requests? Or is
this not a good solution at all?

[1] http://markmail.org/message/4eh45utq72qf4eqo
[2] http://markmail.org/message/utwgtv7z7rfx6jgl
[3] http://markmail.org/message/fslkzj3dlkbn4lxo

-- 
Vidar S. Ramdal <[EMAIL PROTECTED]> - http://www.idium.no
Akersgata 16, N-0158 Oslo, Norway

Reply via email to