- Repository repository = bc.getService(
- bc.getServiceReferences(Repository.class, "(cn=" + NodeConstants.HOME + ")").iterator().next());
- Session session = repository.login();
- JcrFileSystem fileSystem = new JcrFileSystem(this, session);
- fileSystems.put(username, fileSystem);
- return fileSystem;
+ String host = uri.getHost();
+ if (host != null && !host.trim().equals("")) {
+ URI repoUri = new URI("http", uri.getUserInfo(), uri.getHost(), uri.getPort(), "/jcr/node", null, null);
+ RepositoryFactory repositoryFactory = bc.getService(bc.getServiceReference(RepositoryFactory.class));
+ Repository repository = NodeUtils.getRepositoryByUri(repositoryFactory, repoUri.toString());
+ Session session = repository.login("main");
+ CmsFileSystem fileSystem = new CmsFileSystem(this, session);
+ fileSystems.put(username, fileSystem);
+ return fileSystem;
+ } else {
+ Repository repository = bc.getService(
+ bc.getServiceReferences(Repository.class, "(cn=" + NodeConstants.HOME + ")").iterator().next());
+ Session session = repository.login();
+ CmsFileSystem fileSystem = new CmsFileSystem(this, session);
+ fileSystems.put(username, fileSystem);
+ return fileSystem;
+ }