Mercurial > dive4elements > gnv-client
diff gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java @ 583:2f3d885fed09
Adjusted http requests and appended a new parameter export mode to 'out'-xml document to choose between svg, pdf or image exports.
gnv/trunk@725 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 02 Mar 2010 14:55:29 +0000 |
parents | bd67164cf28b |
children | 2e690cb2247c |
line wrap: on
line diff
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Tue Mar 02 10:53:30 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java Tue Mar 02 14:55:29 2010 +0000 @@ -678,14 +678,23 @@ * java.io.OutputStream, java.lang.String, java.lang.String, * java.util.Collection) */ - public void doOutput(ArtifactObject artifactFactory, - ArtifactObject currentArtifact, OutputStream stream, - String targetName, String mimeType, - Collection<InputParameter> inputParameter) - throws ArtifactDatabaseClientException { + public void doOutput( + ArtifactObject artifactFactory, + ArtifactObject currentArtifact, + OutputStream stream, + String targetName, + String exportMode, + String mimeType, + Collection<InputParameter> inputParameter) + throws ArtifactDatabaseClientException + { try { - Document requestBody = this.createOutRequestBody(currentArtifact, - targetName, mimeType, inputParameter); + Document requestBody = this.createOutRequestBody( + currentArtifact, + targetName, + exportMode, + mimeType, + inputParameter); String requestUrl = this.getArtifactUrl(artifactFactory, currentArtifact) @@ -704,10 +713,12 @@ } private Document createOutRequestBody( - ArtifactObject currentArtifact, - String target, - String mimeType, - Collection<InputParameter> inputParameter) { + ArtifactObject currentArtifact, + String target, + String exportMode, + String mimeType, + Collection<InputParameter> inputParameter) + { Document document = new XMLUtils().newDocument(); Node rootNode = this.createRootNode(document); @@ -727,6 +738,10 @@ outNode.setAttribute("name", target); rootNode.appendChild(outNode); + Element exportNode = this.createArtifactElement(document, "export"); + exportNode.setAttribute("name", exportMode); + outNode.appendChild(exportNode); + Element mimeTypeNode = this.createArtifactElement(document, "mime-type"); mimeTypeNode.setAttribute("value", mimeType); outNode.appendChild(mimeTypeNode); @@ -779,7 +794,7 @@ String target = "wms"; String requestURL = getArtifactUrl(factory, artifact) + "/" + target; Document request = createOutRequestBody( - artifact, target, "text/xml", null); + artifact, target, "", "text/xml", null); try { InputStream input = doPostRequest(requestURL, request); Document result = XMLUtils.readDocument(input); @@ -806,7 +821,7 @@ String requestUrl = this.getArtifactUrl(artifactFactory, currentArtifact) + "/" + targetName; Document requestBody = this.createOutRequestBody(currentArtifact, - targetName, "text/xml", null); + targetName, "", "text/xml", null); XMLUtils xmlUtils = new XMLUtils(); InputStream is = this.doPostRequest(requestUrl, requestBody); Document resultDocument = xmlUtils.readDocument(is);