comparison gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java @ 36:ad381cc47217

Format Code to max 80 Chars per Row gnv/trunk@172 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 02 Oct 2009 08:54:13 +0000
parents 25fdec8b4c69
children fccf90761825
comparison
equal deleted inserted replaced
35:4405f31bbc30 36:ad381cc47217
8 8
9 import org.apache.log4j.Logger; 9 import org.apache.log4j.Logger;
10 10
11 /** 11 /**
12 * @author Tim Englich <tim.englich@intevation.de> 12 * @author Tim Englich <tim.englich@intevation.de>
13 * 13 *
14 */ 14 */
15 public class DoExportAction extends DoOutputAction { 15 public class DoExportAction extends DoOutputAction {
16 16
17 /** 17 /**
18 * the logger, used to log exceptions and additonaly information 18 * the logger, used to log exceptions and additonaly information
19 */ 19 */
20 private static Logger log = Logger.getLogger(DoExportAction.class); 20 private static Logger log = Logger.getLogger(DoExportAction.class);
21 21
22 /** 22 /**
23 * Constructor 23 * Constructor
24 */ 24 */
25 public DoExportAction() { 25 public DoExportAction() {
26 super(); 26 super();
30 protected void setHeaders(String target, String mimeType, 30 protected void setHeaders(String target, String mimeType,
31 HttpServletResponse response, HttpServletRequest request) { 31 HttpServletResponse response, HttpServletRequest request) {
32 log.debug("DoExportAction.setHeaders"); 32 log.debug("DoExportAction.setHeaders");
33 try { 33 try {
34 super.setHeaders(target, mimeType, response, request); 34 super.setHeaders(target, mimeType, response, request);
35 String fileName = "GNVEXPORT_"+System.currentTimeMillis()+"."; 35 String fileName = "GNVEXPORT_" + System.currentTimeMillis() + ".";
36 36
37 if (target.equalsIgnoreCase("chart")){ 37 if (target.equalsIgnoreCase("chart")) {
38 fileName = fileName + mimeType.substring(mimeType.indexOf("/")+1); 38 fileName = fileName
39 }else if (target.equalsIgnoreCase("CSV")){ 39 + mimeType.substring(mimeType.indexOf("/") + 1);
40 fileName = fileName +"csv"; 40 } else if (target.equalsIgnoreCase("CSV")) {
41 }else{ 41 fileName = fileName + "csv";
42 fileName = fileName +"txt"; 42 } else {
43 fileName = fileName + "txt";
43 } 44 }
44 log.debug("FileName for Export: "+fileName); 45 log.debug("FileName for Export: " + fileName);
45 response.setHeader("Content-Disposition","attachment;filename="+fileName); 46 response.setHeader("Content-Disposition", "attachment;filename="
47 + fileName);
46 } catch (Exception e) { 48 } catch (Exception e) {
47 log.error(e,e); 49 log.error(e, e);
48 } 50 }
49 } 51 }
50 52
51
52 } 53 }

http://dive4elements.wald.intevation.org