494816c9 by Ean Schuessler

Merge branch 'BF-5185-5144' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet

2 parents 8cf89907 477760f7
...@@ -275,6 +275,18 @@ public class DirectControlServlet extends HttpServlet { ...@@ -275,6 +275,18 @@ public class DirectControlServlet extends HttpServlet {
275 response.setStatus(400); 275 response.setStatus(400);
276 } 276 }
277 277
278 // Set to expire far in the past.
279 response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
280
281 // Set standard HTTP/1.1 no-cache headers.
282 response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
283
284 // Set IE extended HTTP/1.1 no-cache headers (use addHeader).
285 response.addHeader("Cache-Control", "post-check=0, pre-check=0");
286
287 // Set standard HTTP/1.0 no-cache header.
288 response.setHeader("Pragma", "no-cache");
289
278 if ("JSON".equals(outputHandler)) { 290 if ("JSON".equals(outputHandler)) {
279 response.setContentType("application/x-json"); 291 response.setContentType("application/x-json");
280 292
...@@ -313,7 +325,8 @@ public class DirectControlServlet extends HttpServlet { ...@@ -313,7 +325,8 @@ public class DirectControlServlet extends HttpServlet {
313 } 325 }
314 326
315 if (data.size() > 0) { 327 if (data.size() > 0) {
316 Iterator hi = ((Map) data.get(0)).keySet().iterator(); 328 Set keys = ((Map) data.get(0)).keySet();
329 Iterator hi = keys.iterator();
317 StringBuffer csvBuf = new StringBuffer(); 330 StringBuffer csvBuf = new StringBuffer();
318 while(hi.hasNext()) { 331 while(hi.hasNext()) {
319 csvBuf.append(hi.next()); 332 csvBuf.append(hi.next());
...@@ -322,10 +335,11 @@ public class DirectControlServlet extends HttpServlet { ...@@ -322,10 +335,11 @@ public class DirectControlServlet extends HttpServlet {
322 writer.println(csvBuf); 335 writer.println(csvBuf);
323 336
324 for (Map row : data) { 337 for (Map row : data) {
325 Iterator i = row.values().iterator(); 338 Iterator i = keys.iterator();
326 csvBuf = new StringBuffer(); 339 csvBuf = new StringBuffer();
327 while(i.hasNext()) { 340 while(i.hasNext()) {
328 csvBuf.append(i.next()); 341 Object val = row.get(i.next());
342 if (!"null".equals("" + val)) csvBuf.append(val);
329 if (i.hasNext()) csvBuf.append(","); 343 if (i.hasNext()) csvBuf.append(",");
330 } 344 }
331 writer.println(csvBuf); 345 writer.println(csvBuf);
......
...@@ -53,8 +53,8 @@ public class LibreOfficeRenderer { ...@@ -53,8 +53,8 @@ public class LibreOfficeRenderer {
53 53
54 ProcessBuilder pb = new ProcessBuilder("libreoffice", "--headless", "--convert-to", "pdf", outputFile.getPath(), "--outdir", outputFile.getParentFile().getPath()); 54 ProcessBuilder pb = new ProcessBuilder("libreoffice", "--headless", "--convert-to", "pdf", outputFile.getPath(), "--outdir", outputFile.getParentFile().getPath());
55 Map<String, String> env = pb.environment(); 55 Map<String, String> env = pb.environment();
56 env.put("HOME", "/home/ofbiz"); 56 env.put("HOME", "/home/driverup");
57 env.put("USERNAME", "ofbiz"); 57 env.put("USERNAME", "driverup");
58 Process process = pb.start(); 58 Process process = pb.start();
59 InputStream is = process.getInputStream(); 59 InputStream is = process.getInputStream();
60 process.waitFor(); 60 process.waitFor();
......