82e529cf by bank

add content to agreement entity. [Ticket #4656][43140]

1 parent 494816c9
...@@ -354,6 +354,9 @@ public class DirectControlServlet extends HttpServlet { ...@@ -354,6 +354,9 @@ public class DirectControlServlet extends HttpServlet {
354 if ("PDF".equals(outputHandler)) { 354 if ("PDF".equals(outputHandler)) {
355 LibreOfficeRenderer.service(request, response, result); 355 LibreOfficeRenderer.service(request, response, result);
356 } 356 }
357 if ("PPDF".equals(outputHandler)) {
358 PDFRenderer.service(request, response, result);
359 }
357 } catch (Throwable t) { 360 } catch (Throwable t) {
358 response.setStatus(500); 361 response.setStatus(500);
359 PrintWriter writer = response.getWriter(); 362 PrintWriter writer = response.getWriter();
......
1 package com.brainfood.ofbiz;
2
3 import javax.servlet.http.HttpServletRequest;
4 import javax.servlet.http.HttpServletResponse;
5
6 import java.util.Map;
7 import java.util.List;
8 import java.util.ArrayList;
9 import java.util.Arrays;
10
11 import java.io.File;
12 import java.io.InputStream;
13 import java.io.FileInputStream;
14 import java.io.IOException;
15
16 import org.ofbiz.base.util.UtilIO;
17 import org.ofbiz.base.component.ComponentConfig;
18 import org.ofbiz.base.component.ComponentException;
19
20 public class PDFRenderer {
21 public static void service(HttpServletRequest request, HttpServletResponse response, Map<String, Object> context)
22 throws InterruptedException, IOException, ClassNotFoundException, ComponentException {
23 Object pdfFile = context.get("pdfPath");
24
25 if (pdfFile != null) {
26 String fullPath = ComponentConfig.getRootLocation("driverup") + pdfFile;
27
28 response.setContentType("application/pdf");
29 UtilIO.copy(new FileInputStream(fullPath), true, response.getOutputStream(), true);
30 }
31 }
32 }