Author: angela Date: Thu Nov 22 07:04:03 2007 New Revision: 597420 URL: http://svn.apache.org/viewvc?rev=597420&view=rev Log: JCR-1230 Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java?rev=597420&r1=597419&r2=597420&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java (original) +++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/RootCollection.java Thu Nov 22 07:04:03 2007 @@ -31,10 +31,14 @@ import org.slf4j.LoggerFactory; import javax.jcr.RepositoryException; +import javax.jcr.Session; +import javax.jcr.Repository; import java.util.ArrayList; import java.util.List; import java.util.Date; import java.io.IOException; +import java.io.PrintWriter; +import java.io.OutputStreamWriter; /** * RootCollection represent the WebDAV root resource that does not @@ -123,8 +127,44 @@ * @throws IOException */ public void spool(OutputContext outputContext) throws IOException { - outputContext.setContentLength(0); - outputContext.setModificationTime(getModificationTime()); + if (outputContext.hasStream()) { + Session session = getRepositorySession(); + Repository rep = session.getRepository(); + String repName = rep.getDescriptor(Repository.REP_NAME_DESC); + String repURL = rep.getDescriptor(Repository.REP_VENDOR_URL_DESC); + String repVersion = rep.getDescriptor(Repository.REP_VERSION_DESC); + String repostr = repName + " " + repVersion; + + StringBuffer sb = new StringBuffer(); + sb.append(""); + sb.append(repostr); + sb.append(""); + sb.append("

").append(repostr).append("

"); + sb.append("

Available Workspace Resources:


Powered by ").append(repName); + sb.append(" ").append(repVersion); + sb.append(""); + + outputContext.setContentLength(sb.length()); + outputContext.setModificationTime(getModificationTime()); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(outputContext.getOutputStream(), "utf8")); + writer.print(sb.toString()); + writer.close(); + } else { + outputContext.setContentLength(0); + outputContext.setModificationTime(getModificationTime()); + } } /** Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java?rev=597420&r1=597419&r2=597420&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java (original) +++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java Thu Nov 22 07:04:03 2007 @@ -49,6 +49,7 @@ import javax.jcr.Workspace; import javax.jcr.Item; import javax.jcr.Session; +import javax.jcr.Repository; import javax.jcr.version.Version; import javax.jcr.observation.EventListener; import java.util.Iterator; @@ -58,6 +59,8 @@ import java.util.Map; import java.util.HashMap; import java.io.IOException; +import java.io.PrintWriter; +import java.io.OutputStreamWriter; /** * WorkspaceResourceImpl... @@ -136,8 +139,43 @@ * @throws IOException */ public void spool(OutputContext outputContext) throws IOException { - outputContext.setContentLength(0); - outputContext.setModificationTime(getModificationTime()); + if (outputContext.hasStream()) { + Session session = getRepositorySession(); + Repository rep = session.getRepository(); + String repName = rep.getDescriptor(Repository.REP_NAME_DESC); + String repURL = rep.getDescriptor(Repository.REP_VENDOR_URL_DESC); + String repVersion = rep.getDescriptor(Repository.REP_VERSION_DESC); + String repostr = repName + " " + repVersion; + + StringBuffer sb = new StringBuffer(); + sb.append(""); + sb.append(repostr); + sb.append(""); + sb.append("

").append(repostr).append("


Powered by ").append(repName); + sb.append(" ").append(repVersion); + sb.append(""); + + outputContext.setContentLength(sb.length()); + outputContext.setModificationTime(getModificationTime()); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(outputContext.getOutputStream(), "utf8")); + writer.print(sb.toString()); + writer.close(); + } else { + outputContext.setContentLength(0); + outputContext.setModificationTime(getModificationTime()); + } } /** @@ -397,7 +435,7 @@ super.initSupportedReports(); supportedReports.addReportType(JcrPrivilegeReport.PRIVILEGES_REPORT); } - + protected String getWorkspaceHref() { return getHref(); }