# HG changeset patch # User Ingo Weinzierl # Date 1269252933 0 # Node ID 2943f69e006fa155ab7ae4b14d7a1fb85a149cd6 # Parent 8315b0a40329f4a608844cb39b824e018adca2a5 Removed xml parsing from InputStream while exporting an artifact. Just copy the input stream to the output stream. gnv/trunk@813 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 8315b0a40329 -r 2943f69e006f gnv/ChangeLog --- a/gnv/ChangeLog Mon Mar 22 09:49:48 2010 +0000 +++ b/gnv/ChangeLog Mon Mar 22 10:15:33 2010 +0000 @@ -1,3 +1,9 @@ +2010-03-22 Ingo Weinzierl + + * src/main/java/de/intevation/gnv/action/LoadAction.java: Just copy the + input stream to the output stream without parsing it and without creating + a temporary xml document. + 2010-03-22 Tim Englich * src/main/webapp/WEB-INF/jsp/wmslayout.jsp, diff -r 8315b0a40329 -r 2943f69e006f gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java --- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Mon Mar 22 09:49:48 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Mon Mar 22 10:15:33 2010 +0000 @@ -2,7 +2,9 @@ import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -726,18 +728,41 @@ OutputStream out) throws ArtifactDatabaseClientException { + InputStreamReader reader = null; + OutputStreamWriter writer = null; + try { String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl(); url += "/export/" + currentArtifact.getId(); - Document response = doGetRequest(url); - XMLUtils.toStream(response, out); + Representation response = doGetRequestInternal(url, null); + InputStream in = response.getStream(); + + reader = new InputStreamReader(in); + writer = new OutputStreamWriter(out); + + while (reader.ready()) { + writer.write(reader.read()); + } + } catch (Exception e) { log.error(e, e); throw new ArtifactDatabaseClientException(e); } + finally { + try { + reader.close(); + } catch (IOException ioe) {} + try { + writer.flush(); + } catch (IOException ioe) {} + + try { + writer.close(); + } catch (IOException ioe) {} + } }