Package org.geomajas.widget.searchandfilter.service.FileDownloadService

Examples of org.geomajas.widget.searchandfilter.service.FileDownloadService.Item


  private FileDownloadService service;

  @RequestMapping(value = "/csvDownload", method = RequestMethod.GET)
  public void handleCsvDownload(@RequestParam("id") String id, HttpServletResponse response) throws IOException {
    try {
      Item item = service.getFile(id);
      File f = item.getFile();
      if (f == null || !f.canRead()) {
        response.sendError(404, "Geen document gevonden met id: " + id);
      } else {
        // Set response headers
        response.setContentType("text/csv");
        response.setContentLength((int) f.length());
        String filename = (item.getDescription());
        response.setHeader("Content-Disposition", "attachment; filename=" + filename);

        FileInputStream fis = new FileInputStream(f);
        FileChannel in = fis.getChannel();
        WritableByteChannel out = Channels.newChannel(response.getOutputStream());
View Full Code Here

TOP

Related Classes of org.geomajas.widget.searchandfilter.service.FileDownloadService.Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.