use of org.apache.sling.jcr.webdav.impl.helper.SlingLocatorFactory in project sling by apache.
the class SlingWebDavServlet method getLocatorFactory.
@Override
public DavLocatorFactory getLocatorFactory() {
if (locatorFactory == null) {
// configured default workspace name
SlingRepository slingRepo = (SlingRepository) getRepository();
String workspace = slingRepo.getDefaultWorkspace();
// no configuration, try to login and acquire the default name
if (workspace == null || workspace.length() == 0) {
Session tmp = null;
try {
tmp = slingRepo.login();
workspace = tmp.getWorkspace().getName();
} catch (Throwable t) {
// TODO: log !!
// fall back name
workspace = "default";
} finally {
if (tmp != null) {
tmp.logout();
}
}
}
locatorFactory = new SlingLocatorFactory(workspace);
}
return locatorFactory;
}
Aggregations