Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java @ 4424:6ef48927df38
Remove authentication from MapPrintServiceImpl.
Printing maps was broken because the called service
required user authentication. The /flys/mapfish-print/print.pdf URI
is now whitelisted in GGInAFilter.
TODO: Support user authentication in MapPrintServiceImpl.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 06 Nov 2012 14:50:26 +0100 |
parents | 51ed89b754ae |
children | 5b8919ef601d |
comparison
equal
deleted
inserted
replaced
4423:687b7a6f09aa | 4424:6ef48927df38 |
---|---|
1 package de.intevation.flys.client.server; | 1 package de.intevation.flys.client.server; |
2 | 2 |
3 import de.intevation.artifacts.common.ArtifactNamespaceContext; | 3 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
4 | |
5 import de.intevation.artifacts.common.utils.ClientProtocolUtils; | 4 import de.intevation.artifacts.common.utils.ClientProtocolUtils; |
6 import de.intevation.artifacts.common.utils.JSON; | 5 import de.intevation.artifacts.common.utils.JSON; |
7 import de.intevation.artifacts.common.utils.StringUtils; | 6 import de.intevation.artifacts.common.utils.StringUtils; |
8 import de.intevation.artifacts.common.utils.XMLUtils; | 7 import de.intevation.artifacts.common.utils.XMLUtils; |
9 | |
10 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; | 8 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
11 | |
12 import de.intevation.artifacts.httpclient.http.HttpClient; | 9 import de.intevation.artifacts.httpclient.http.HttpClient; |
13 import de.intevation.artifacts.httpclient.http.HttpClientImpl; | 10 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
14 | |
15 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; | 11 import de.intevation.artifacts.httpclient.http.response.DocumentResponseHandler; |
16 | 12 import de.intevation.flys.client.shared.MapUtils; |
17 import de.intevation.flys.client.shared.model.MapConfig; | 13 import de.intevation.flys.client.shared.model.MapConfig; |
18 import de.intevation.flys.client.shared.MapUtils; | 14 |
19 | 15 import java.io.IOException; |
16 import java.io.InputStream; | |
17 import java.io.OutputStream; | |
18 import java.io.UnsupportedEncodingException; | |
19 import java.net.URLEncoder; | |
20 import java.util.ArrayList; | |
21 import java.util.Collections; | |
22 import java.util.LinkedHashMap; | |
23 import java.util.List; | |
24 import java.util.Map; | |
25 | |
26 import javax.servlet.ServletException; | |
27 import javax.servlet.http.HttpServlet; | |
28 import javax.servlet.http.HttpServletRequest; | |
29 import javax.servlet.http.HttpServletResponse; | |
30 | |
31 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; | |
32 import org.apache.commons.httpclient.methods.GetMethod; | |
33 import org.apache.log4j.Logger; | |
34 import org.w3c.dom.Document; | |
35 import org.w3c.dom.Element; | |
36 import org.w3c.dom.NodeList; | |
20 /* | 37 /* |
21 import java.io.BufferedInputStream; | 38 import java.io.BufferedInputStream; |
22 import java.io.BufferedOutputStream; | 39 import java.io.BufferedOutputStream; |
23 import java.io.File; | 40 import java.io.File; |
24 import java.io.FileInputStream; | 41 import java.io.FileInputStream; |
25 import java.io.FileOutputStream; | 42 import java.io.FileOutputStream; |
26 */ | 43 */ |
27 import java.io.IOException; | |
28 import java.io.InputStream; | |
29 import java.io.OutputStream; | |
30 import java.io.UnsupportedEncodingException; | |
31 | |
32 import java.net.URLEncoder; | |
33 | |
34 import java.util.ArrayList; | |
35 import java.util.Collections; | |
36 import java.util.LinkedHashMap; | |
37 import java.util.List; | |
38 import java.util.Map; | |
39 | |
40 import javax.servlet.ServletException; | |
41 | |
42 import javax.servlet.http.HttpServlet; | |
43 import javax.servlet.http.HttpServletRequest; | |
44 import javax.servlet.http.HttpServletResponse; | |
45 | |
46 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; | |
47 | |
48 import org.apache.commons.httpclient.methods.GetMethod; | |
49 | |
50 import org.apache.log4j.Logger; | |
51 | |
52 /* Used by direct API call. -> Enforce GPLv3 | 44 /* Used by direct API call. -> Enforce GPLv3 |
53 import org.mapfish.print.MapPrinter; | 45 import org.mapfish.print.MapPrinter; |
54 import org.mapfish.print.output.OutputFactory; | 46 import org.mapfish.print.output.OutputFactory; |
55 import org.mapfish.print.output.OutputFormat; | 47 import org.mapfish.print.output.OutputFormat; |
56 | 48 |
57 import org.mapfish.print.utils.PJsonObject; | 49 import org.mapfish.print.utils.PJsonObject; |
58 */ | 50 */ |
59 | |
60 import org.w3c.dom.Document; | |
61 import org.w3c.dom.Element; | |
62 import org.w3c.dom.NodeList; | |
63 | 51 |
64 public class MapPrintServiceImpl | 52 public class MapPrintServiceImpl |
65 extends HttpServlet | 53 extends HttpServlet |
66 { | 54 { |
67 private static final Logger log = | 55 private static final Logger log = |
369 | 357 |
370 org.apache.commons.httpclient.HttpClient client = | 358 org.apache.commons.httpclient.HttpClient client = |
371 new org.apache.commons.httpclient.HttpClient( | 359 new org.apache.commons.httpclient.HttpClient( |
372 new MultiThreadedHttpConnectionManager()); | 360 new MultiThreadedHttpConnectionManager()); |
373 | 361 |
362 // FIXME: The request is not authenticated. | |
363 // Currently this is not a problem because /flys/map-print | |
364 // is whitelisted in GGInAFilter. | |
374 GetMethod get = new GetMethod(url); | 365 GetMethod get = new GetMethod(url); |
375 int result = client.executeMethod(get); | 366 int result = client.executeMethod(get); |
376 InputStream in = get.getResponseBodyAsStream(); | 367 InputStream in = get.getResponseBodyAsStream(); |
377 | 368 |
378 if (in != null) { | 369 if (in != null) { |