Revision 5752
Added by ben leinfelder over 13 years ago
ReplicationService.java | ||
---|---|---|
33 | 33 |
import java.net.*; |
34 | 34 |
import java.text.*; |
35 | 35 |
|
36 |
import javax.servlet.ServletOutputStream; |
|
36 | 37 |
import javax.servlet.http.*; |
37 | 38 |
|
38 | 39 |
import edu.ucsb.nceas.metacat.DocInfoHandler; |
... | ... | |
1113 | 1114 |
// it to disk. |
1114 | 1115 |
if (FileUtil.getFileStatus(documentPath) == FileUtil.DOES_NOT_EXIST |
1115 | 1116 |
|| FileUtil.getFileSize(documentPath) == 0) { |
1116 |
FileWriter fileWriter = new FileWriter(documentPath);
|
|
1117 |
di.toXml(fileWriter, null, null, true);
|
|
1117 |
FileOutputStream fos = new FileOutputStream(documentPath);
|
|
1118 |
di.toXml(fos, null, null, true);
|
|
1118 | 1119 |
} |
1119 | 1120 |
|
1120 |
// read the file from disk and sent it to PrintWriter
|
|
1121 |
// PrintWriter out = new PrintWriter(streamOut);
|
|
1122 |
di.readFromFileSystem(out, null, null, documentPath); |
|
1121 |
// read the file from disk and send it to outputstream
|
|
1122 |
OutputStream outputStream = response.getOutputStream();
|
|
1123 |
di.readFromFileSystem(outputStream, null, null, documentPath);
|
|
1123 | 1124 |
|
1124 | 1125 |
// response.setContentType("text/xml"); |
1125 | 1126 |
// out.print(di.toString(null, null, true)); |
Also available in: Unified diff
use detected XML encoding when reading/writing files
use UTF-8 as default when performing queries in the DB (assume DB is using UTF-8)
remove as many PrintWriters (uses system default character encoding only) as possible and construct OutputStreamWriters where explicit encoding can be given.
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2495