Mercurial > dive4elements > gnv-client
comparison gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java @ 29:bba8fd97e549
Export and Diagrammoptions integrated into GUI
gnv/trunk@133 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 25 Sep 2009 07:28:49 +0000 |
parents | |
children | 25fdec8b4c69 |
comparison
equal
deleted
inserted
replaced
28:d93ea867406b | 29:bba8fd97e549 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.action; | |
5 | |
6 import javax.servlet.http.HttpServletRequest; | |
7 import javax.servlet.http.HttpServletResponse; | |
8 | |
9 import org.apache.log4j.Logger; | |
10 | |
11 /** | |
12 * @author Tim Englich <tim.englich@intevation.de> | |
13 * | |
14 */ | |
15 public class DoExportAction extends DoOutputAction { | |
16 | |
17 /** | |
18 * the logger, used to log exceptions and additonaly information | |
19 */ | |
20 private static Logger log = Logger.getLogger(DoExportAction.class); | |
21 | |
22 /** | |
23 * Constructor | |
24 */ | |
25 public DoExportAction() { | |
26 super(); | |
27 } | |
28 | |
29 @Override | |
30 protected void setHeaders(String target, String mimeType, | |
31 HttpServletResponse response, HttpServletRequest request) { | |
32 log.debug("DoExportAction.setHeaders"); | |
33 super.setHeaders(target, mimeType, response, request); | |
34 String fileName = "GNVEXPORT_"+System.currentTimeMillis()+"."; | |
35 | |
36 if (target.equalsIgnoreCase("chart")){ | |
37 fileName = fileName + mimeType.substring(mimeType.indexOf("/")+1); | |
38 }else if (target.equalsIgnoreCase("CSV")){ | |
39 fileName = fileName +"csv"; | |
40 }else{ | |
41 fileName = fileName +"txt"; | |
42 } | |
43 log.debug("FileName for Export: "+fileName); | |
44 response.setHeader("Content-Disposition","attachment;filename="+fileName); | |
45 } | |
46 | |
47 | |
48 } |