[Bedework-commit] webdav r241 - trunk/server/src/edu/rpi/cct/webdav/servlet/shared

svnadmin at bedework.org svnadmin at bedework.org
Wed Sep 15 11:05:08 EDT 2010


Author: douglm
Date: 2010-09-15 11:05:08 -0400 (Wed, 15 Sep 2010)
New Revision: 241

Modified:
   trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsNode.java
   trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavPrincipalNode.java
Log:
Pay some attention to the ACCEPT values or the data type in the calendar-data element. Allow for different default content-types for caldav and web service.

Implement generation of XML and produce that when appropriate

Modified: trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsNode.java
===================================================================
--- trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsNode.java	2010-09-09 14:07:30 UTC (rev 240)
+++ trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsNode.java	2010-09-15 15:05:08 UTC (rev 241)
@@ -26,6 +26,7 @@
 
 package edu.rpi.cct.webdav.servlet.shared;
 
+import edu.rpi.cct.webdav.servlet.shared.WebdavNsIntf.Content;
 import edu.rpi.cmt.access.AccessPrincipal;
 import edu.rpi.cmt.access.AccessXmlUtil;
 import edu.rpi.cmt.access.PrivilegeSet;
@@ -38,9 +39,9 @@
 import org.w3c.dom.Element;
 
 import java.io.InputStream;
-import java.io.Reader;
 import java.io.Serializable;
 import java.io.StringReader;
+import java.io.Writer;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -803,19 +804,26 @@
   }
   */
 
-  /** Returns a Reader for the content.
+  /** Returns the content.
    *
-   * @return Reader       A reader for the content.
+   * @param contentType
+   * @return Content object
    * @throws WebdavException
    */
-  public Reader getContent() throws WebdavException {
+  public Content getContent(final String contentType) throws WebdavException {
     String cont = getContentString();
 
     if (cont == null) {
       return null;
     }
 
-    return new StringReader(cont);
+    Content c = new Content();
+
+    c.rdr = new StringReader(cont);
+    c.contentType = getContentType();
+    c.contentLength = getContentLen();
+
+    return c;
   }
 
   /** Returns an InputStream for the content.
@@ -847,6 +855,18 @@
    *                   Required webdav properties
    * ==================================================================== */
 
+  /** Called during xml emission to write the content for the node.
+   *
+   * @param xml - if this is embedded in an xml stream
+   * @param wtr - if standalone output or no xml stream initialized.
+   * @return boolean true if content written OK
+   * @param contentType desired content type or null for default.
+   * @throws WebdavException
+   */
+  public abstract boolean writeContent(XmlEmit xml,
+                                       Writer wtr,
+                                       String contentType) throws WebdavException;
+
   /**
    * @return boolean true if this is binary content
    * @throws WebdavException

Modified: trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavPrincipalNode.java
===================================================================
--- trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavPrincipalNode.java	2010-09-09 14:07:30 UTC (rev 240)
+++ trunk/server/src/edu/rpi/cct/webdav/servlet/shared/WebdavPrincipalNode.java	2010-09-15 15:05:08 UTC (rev 241)
@@ -62,6 +62,7 @@
 
 import org.w3c.dom.Element;
 
+import java.io.Writer;
 import java.util.Collection;
 import java.util.HashMap;
 
@@ -165,6 +166,13 @@
    *                   Required webdav properties
    * ==================================================================== */
 
+  @Override
+  public boolean writeContent(final XmlEmit xml,
+                              final Writer wtr,
+                              final String contentType) throws WebdavException {
+    return false;
+  }
+
   /* (non-Javadoc)
    * @see edu.rpi.cct.webdav.servlet.shared.WebdavNsNode#getContentBinary()
    */



More information about the Bedework-commit mailing list