Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java @ 240:4cdf9030854f
Added i18n strings for the computed discharge curve.
flys-client/trunk@1816 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 04 May 2011 07:36:20 +0000 |
parents | 7ea004d0ffbc |
children | 6838e4112eeb |
rev | line source |
---|---|
78
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.OutputStream; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.IOException; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.w3c.dom.Document; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import javax.servlet.http.HttpServlet; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import javax.servlet.http.HttpServletRequest; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.servlet.http.HttpServletResponse; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
213
7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
78
diff
changeset
|
12 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
78
diff
changeset
|
13 |
78
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifacts.httpclient.http.HttpClient; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 /** |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * This service is used to request a chart from the artifact server. The |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * response is directed directly to the output stream, so the image that is |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 * retrieved is displayed in the UI afterwards. |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 * |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 */ |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public class ChartOutputServiceImpl |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 extends HttpServlet |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 { |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 public void doGet(HttpServletRequest req, HttpServletResponse resp) { |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 System.out.println("ChartOutputServiceImpl.doGet"); |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 try { |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 OutputStream out = resp.getOutputStream(); |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 String serverUrl = req.getParameter("server"); |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 String uuid = req.getParameter("uuid"); |
213
7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
78
diff
changeset
|
36 String type = req.getParameter("type"); |
78
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 String mimeType = "image/png"; |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
213
7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
78
diff
changeset
|
39 Document request = ClientProtocolUtils.newOutCollectionDocument( |
7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
78
diff
changeset
|
40 uuid, type); |
78
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 HttpClient client = new HttpClientImpl(serverUrl); |
213
7ea004d0ffbc
The ChartOutputTab calls the out() operation of a Collection now - no longer the out() of its first artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
78
diff
changeset
|
43 client.collectionOut(request, uuid, "chart", out); |
78
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 out.close(); |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 out.flush(); |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 } |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 catch (IOException ioe) { |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 System.err.println(ioe.getMessage()); |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 } |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 } |
9ca5160cf080
Added a service that builds up requests to retrieve chart images. Use this service to display charts in the ChartOutputTab.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 } |