You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2011/06/03 00:05:40 UTC
svn commit: r1130844 -
/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Author: justin
Date: Thu Jun 2 22:05:40 2011
New Revision: 1130844
URL: http://svn.apache.org/viewvc?rev=1130844&view=rev
Log:
SLING-2095 - extracting workspace name from path if it is present
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=1130844&r1=1130843&r2=1130844&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java (original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java Thu Jun 2 22:05:40 2011
@@ -329,22 +329,34 @@ public class JcrResourceResolver
public Resource resolve(HttpServletRequest request, String absPath) {
checkClosed();
+ String workspaceName = null;
+
// make sure abspath is not null and is absolute
if (absPath == null) {
absPath = "/";
} else if (!absPath.startsWith("/")) {
- absPath = "/" + absPath;
+ if (useMultiWorkspaces) {
+ final int wsSepPos = absPath.indexOf(":/");
+ if (wsSepPos != -1) {
+ workspaceName = absPath.substring(0, wsSepPos);
+ absPath = absPath.substring(wsSepPos + 1);
+ } else {
+ absPath = "/" + absPath;
+ }
+ } else {
+ absPath = "/" + absPath;
+ }
}
// check for special namespace prefix treatment
absPath = unmangleNamespaces(absPath);
-
- String workspaceName = null;
if (useMultiWorkspaces) {
- // check for workspace info
- workspaceName = (request == null ? null :
- (String)request.getAttribute(ResourceResolver.REQUEST_ATTR_WORKSPACE_INFO));
- if ( workspaceName != null && !workspaceName.equals(getSession().getWorkspace().getName())) {
+ if (workspaceName == null) {
+ // check for workspace info from request
+ workspaceName = (request == null ? null :
+ (String)request.getAttribute(ResourceResolver.REQUEST_ATTR_WORKSPACE_INFO));
+ }
+ if (workspaceName != null && !workspaceName.equals(getSession().getWorkspace().getName())) {
LOGGER.debug("Delegating resolving to resolver for workspace {}", workspaceName);
try {
final ResourceResolver wsResolver = getResolverForWorkspace(workspaceName);