82e529cf by bank

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

1 parent 494816c9
......@@ -354,6 +354,9 @@ public class DirectControlServlet extends HttpServlet {
if ("PDF".equals(outputHandler)) {
LibreOfficeRenderer.service(request, response, result);
}
if ("PPDF".equals(outputHandler)) {
PDFRenderer.service(request, response, result);
}
} catch (Throwable t) {
response.setStatus(500);
PrintWriter writer = response.getWriter();
......
package com.brainfood.ofbiz;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.io.File;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
import org.ofbiz.base.util.UtilIO;
import org.ofbiz.base.component.ComponentConfig;
import org.ofbiz.base.component.ComponentException;
public class PDFRenderer {
public static void service(HttpServletRequest request, HttpServletResponse response, Map<String, Object> context)
throws InterruptedException, IOException, ClassNotFoundException, ComponentException {
Object pdfFile = context.get("pdfPath");
if (pdfFile != null) {
String fullPath = ComponentConfig.getRootLocation("driverup") + pdfFile;
response.setContentType("application/pdf");
UtilIO.copy(new FileInputStream(fullPath), true, response.getOutputStream(), true);
}
}
}