You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by vg...@apache.org on 2008/11/07 17:02:17 UTC
svn commit: r712177 -
/xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java
Author: vgritsenko
Date: Fri Nov 7 08:02:03 2008
New Revision: 712177
URL: http://svn.apache.org/viewvc?rev=712177&view=rev
Log:
Send multistatus DAV response in utf-8
Modified:
xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java
Modified: xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java
URL: http://svn.apache.org/viewvc/xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java?rev=712177&r1=712176&r2=712177&view=diff
==============================================================================
--- xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java (original)
+++ xml/xindice/trunk/java/src/org/apache/xindice/webadmin/webdav/DAVResponse.java Fri Nov 7 08:02:03 2008
@@ -17,13 +17,16 @@
package org.apache.xindice.webadmin.webdav;
-import org.apache.xindice.webadmin.PartialResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xindice.webadmin.PartialResponse;
-import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+
import java.io.IOException;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
/**
* This is a wrapper class that provides additional DAV-specific functionality
@@ -33,13 +36,13 @@
public class DAVResponse {
public static final String DAV_NS = "DAV:";
- protected final ServletOutputStream out;
+ private static final Log log = LogFactory.getLog(DAVResponse.class);
- private boolean isMultistatus;
private final HttpServletResponse response;
- private String protocol;
- private static final Log log = LogFactory.getLog(DAVResponse.class);
+ protected final Writer out;
+ private boolean isMultistatus;
+ private String protocol;
/**
* Creates new instance of DAVRequest.
@@ -49,7 +52,7 @@
*/
public DAVResponse(HttpServletResponse response) throws IOException {
this.response = response;
- this.out = response.getOutputStream();
+ this.out = new OutputStreamWriter(response.getOutputStream(), "utf-8");
}
/**
@@ -65,12 +68,12 @@
log.debug("Sending response for HREF " + res.getHref());
}
response.setStatus(WebdavStatus.SC_MULTI_STATUS);
- out.println("<?xml version='1.0' encoding='utf-8' ?>");
- out.println("<multistatus xmlns='DAV:'>");
+ out.write("<?xml version='1.0' encoding='utf-8'?>");
+ out.write("<multistatus xmlns='DAV:'>");
isMultistatus = true;
}
- out.println(res.toString());
+ out.write(res.toString());
}
/**
@@ -82,7 +85,8 @@
*/
public void closeMultistatusResponse() throws IOException {
if (isMultistatus) {
- out.println("</multistatus>");
+ out.write("</multistatus>");
+ out.flush();
}
}