<%@ page import=" org.apache.chemistry.opencmis.client.api.Document, org.apache.chemistry.opencmis.client.api.Folder, org.apache.chemistry.opencmis.client.api.ObjectId, org.apache.chemistry.opencmis.client.api.CmisObject, org.apache.chemistry.opencmis.client.api.Property, org.apache.chemistry.opencmis.client.api.Session, org.apache.chemistry.opencmis.client.api.SessionFactory, org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl, org.apache.chemistry.opencmis.commons.PropertyIds, org.apache.chemistry.opencmis.commons.SessionParameter, org.apache.chemistry.opencmis.commons.data.ContentStream, org.apache.chemistry.opencmis.commons.enums.BindingType, java.io.File, java.io.FilenameFilter, java.util.Collections, java.util.Comparator, java.util.Vector, java.util.Map, java.util.HashMap "%> <% String serverURL = "http://ubsvirt44.uni-muenster.de:8080"; String userID = "troy@vmr.nt"; String passwd = "h3ll0"; String repositoryID = "158794da-0728-4093-b5f6-c2d17b76f58e"; String imageBasePath = "/vmr.nt/"; String dir = request.getParameter("dir"); if (dir == null) { return; } if (dir.charAt(dir.length()-1) == '\\') { dir = dir.substring(0, dir.length()-1) + "/"; } else if (dir.charAt(dir.length()-1) != '/') { dir += "/"; } dir = java.net.URLDecoder.decode(dir, "UTF-8"); if (rootCache != null && "/".equals(dir) && !"true".equals(request.getParameter("nocache"))) { children = rootCache; } else { Session cmisSession = connect(serverURL, userID, passwd, repositoryID); Folder root = (Folder) cmisSession.getObjectByPath(imageBasePath+dir); Vector children = new Vector(); if (root != null) { for (CmisObject o : root.getChildren()) { children.add(new TreeItem(o.getName(), o.getType().getLocalName())); } Collections.sort(children, new Comparator() { public int compare(TreeItem i1, TreeItem i2) { return i1.getName().compareTo(i2.getName()); } }); rootCache = children; } } out.print("
    "); // All dirs for (TreeItem i : children) { if ("Folder".equals(i.getType())) { out.print("
  • " + i.getName() + "
  • "); } } // All files for (TreeItem i : children) { if (!"Folder".equals(i.getType())) { int dotIndex = i.getName().lastIndexOf('.'); String ext = dotIndex > 0 ? i.getName().substring(dotIndex + 1) : ""; out.print("
  • " + i.getName() + "
  • "); } } out.print("
"); %> <%! class TreeItem { public TreeItem(String name, String type) { this.name = name; this.type = type; } public String name; public String type; public String getName() { return name; } public String getType() { return type; } } private static Vector rootCache = null; private Session connect(String serverURL, String userID, String passwd, String repositoryID) { // default factory implementation of client runtime SessionFactory f = SessionFactoryImpl.newInstance(); Map parameter = new HashMap(); // user credentials parameter.put(SessionParameter.USER, userID); parameter.put(SessionParameter.PASSWORD, passwd); // connection settings parameter.put(SessionParameter.BINDING_TYPE, BindingType.WEBSERVICES.value()); parameter.put(SessionParameter.REPOSITORY_ID, repositoryID); parameter.put(SessionParameter.WEBSERVICES_ACL_SERVICE, serverURL + "/alfresco/cmis/ACLService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, serverURL + "/alfresco/cmis/DiscoveryService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, serverURL + "/alfresco/cmis/MultiFilingService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, serverURL + "/alfresco/cmis/NavigationService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, serverURL + "/alfresco/cmis/ObjectService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, serverURL + "/alfresco/cmis/PolicyService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, serverURL + "/alfresco/cmis/RelationshipService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, serverURL + "/alfresco/cmis/RepositoryService?wsdl"); parameter.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, serverURL + "/alfresco/cmis/VersioningService?wsdl"); // cmisSession locale parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, ""); parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "de"); parameter.put(SessionParameter.LOCALE_VARIANT, ""); // create cmisSession Session cmisSession = f.createSession(parameter); System.out.println("Connection Successful: " + cmisSession); return cmisSession; } %>