Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java @ 213:7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
flys-client/trunk@1655 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 07 Apr 2011 11:31:19 +0000 |
parents | 9ca5160cf080 |
children | 6838e4112eeb |
comparison
equal
deleted
inserted
replaced
212:e3ea3c74b7f5 | 213:7ea004d0ffbc |
---|---|
1 package de.intevation.flys.client.server; | 1 package de.intevation.flys.client.server; |
2 | 2 |
3 import java.io.OutputStream; | 3 import java.io.OutputStream; |
4 import java.io.IOException; | 4 import java.io.IOException; |
5 import java.util.HashMap; | |
6 import java.util.Map; | |
7 | 5 |
8 import org.w3c.dom.Document; | 6 import org.w3c.dom.Document; |
9 | 7 |
10 import javax.servlet.http.HttpServlet; | 8 import javax.servlet.http.HttpServlet; |
11 import javax.servlet.http.HttpServletRequest; | 9 import javax.servlet.http.HttpServletRequest; |
12 import javax.servlet.http.HttpServletResponse; | 10 import javax.servlet.http.HttpServletResponse; |
13 | 11 |
12 import de.intevation.artifacts.common.utils.ClientProtocolUtils; | |
13 | |
14 import de.intevation.artifacts.httpclient.http.HttpClient; | 14 import de.intevation.artifacts.httpclient.http.HttpClient; |
15 import de.intevation.artifacts.httpclient.http.HttpClientImpl; | 15 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
16 import de.intevation.artifacts.httpclient.objects.Artifact; | |
17 import de.intevation.artifacts.httpclient.utils.ArtifactProtocolUtils; | |
18 | 16 |
19 | 17 |
20 /** | 18 /** |
21 * This service is used to request a chart from the artifact server. The | 19 * This service is used to request a chart from the artifact server. The |
22 * response is directed directly to the output stream, so the image that is | 20 * response is directed directly to the output stream, so the image that is |
33 try { | 31 try { |
34 OutputStream out = resp.getOutputStream(); | 32 OutputStream out = resp.getOutputStream(); |
35 | 33 |
36 String serverUrl = req.getParameter("server"); | 34 String serverUrl = req.getParameter("server"); |
37 String uuid = req.getParameter("uuid"); | 35 String uuid = req.getParameter("uuid"); |
38 String hash = req.getParameter("hash"); | 36 String type = req.getParameter("type"); |
39 String width = req.getParameter("width"); | |
40 String height = req.getParameter("height"); | |
41 String target = req.getParameter("target"); | |
42 String mimeType = "image/png"; | 37 String mimeType = "image/png"; |
43 | 38 |
44 Map opts = new HashMap(); | 39 Document request = ClientProtocolUtils.newOutCollectionDocument( |
45 opts.put("width", width); | 40 uuid, type); |
46 opts.put("height", height); | |
47 opts.put("mimeType", mimeType); | |
48 opts.put("points", "false"); | |
49 | |
50 Document chart = ArtifactProtocolUtils.createChartDocument( | |
51 new Artifact(hash, uuid), opts); | |
52 | 41 |
53 HttpClient client = new HttpClientImpl(serverUrl); | 42 HttpClient client = new HttpClientImpl(serverUrl); |
54 client.out(new Artifact(uuid, hash), chart, target, out); | 43 client.collectionOut(request, uuid, "chart", out); |
55 | 44 |
56 out.close(); | 45 out.close(); |
57 out.flush(); | 46 out.flush(); |
58 } | 47 } |
59 catch (IOException ioe) { | 48 catch (IOException ioe) { |