Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
ofbiz-directcontrolservlet
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
477760f7
authored
2015-03-19 22:17:52 -0500
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
#5185 #5144 Prevent caching, don't return CSV nulls
1 parent
8cf89907
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
src/com/brainfood/ofbiz/DirectControlServlet.java
src/com/brainfood/ofbiz/LibreOfficeRenderer.java
src/com/brainfood/ofbiz/DirectControlServlet.java
View file @
477760f
...
...
@@ -275,6 +275,18 @@ public class DirectControlServlet extends HttpServlet {
response
.
setStatus
(
400
);
}
// Set to expire far in the past.
response
.
setHeader
(
"Expires"
,
"Sat, 6 May 1995 12:00:00 GMT"
);
// Set standard HTTP/1.1 no-cache headers.
response
.
setHeader
(
"Cache-Control"
,
"no-store, no-cache, must-revalidate"
);
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response
.
addHeader
(
"Cache-Control"
,
"post-check=0, pre-check=0"
);
// Set standard HTTP/1.0 no-cache header.
response
.
setHeader
(
"Pragma"
,
"no-cache"
);
if
(
"JSON"
.
equals
(
outputHandler
))
{
response
.
setContentType
(
"application/x-json"
);
...
...
@@ -313,7 +325,8 @@ public class DirectControlServlet extends HttpServlet {
}
if
(
data
.
size
()
>
0
)
{
Iterator
hi
=
((
Map
)
data
.
get
(
0
)).
keySet
().
iterator
();
Set
keys
=
((
Map
)
data
.
get
(
0
)).
keySet
();
Iterator
hi
=
keys
.
iterator
();
StringBuffer
csvBuf
=
new
StringBuffer
();
while
(
hi
.
hasNext
())
{
csvBuf
.
append
(
hi
.
next
());
...
...
@@ -322,10 +335,11 @@ public class DirectControlServlet extends HttpServlet {
writer
.
println
(
csvBuf
);
for
(
Map
row
:
data
)
{
Iterator
i
=
row
.
values
()
.
iterator
();
Iterator
i
=
keys
.
iterator
();
csvBuf
=
new
StringBuffer
();
while
(
i
.
hasNext
())
{
csvBuf
.
append
(
i
.
next
());
Object
val
=
row
.
get
(
i
.
next
());
if
(!
"null"
.
equals
(
""
+
val
))
csvBuf
.
append
(
val
);
if
(
i
.
hasNext
())
csvBuf
.
append
(
","
);
}
writer
.
println
(
csvBuf
);
...
...
src/com/brainfood/ofbiz/LibreOfficeRenderer.java
View file @
477760f
...
...
@@ -53,8 +53,8 @@ public class LibreOfficeRenderer {
ProcessBuilder
pb
=
new
ProcessBuilder
(
"libreoffice"
,
"--headless"
,
"--convert-to"
,
"pdf"
,
outputFile
.
getPath
(),
"--outdir"
,
outputFile
.
getParentFile
().
getPath
());
Map
<
String
,
String
>
env
=
pb
.
environment
();
env
.
put
(
"HOME"
,
"/home/
ofbiz
"
);
env
.
put
(
"USERNAME"
,
"
ofbiz
"
);
env
.
put
(
"HOME"
,
"/home/
driverup
"
);
env
.
put
(
"USERNAME"
,
"
driverup
"
);
Process
process
=
pb
.
start
();
InputStream
is
=
process
.
getInputStream
();
process
.
waitFor
();
...
...
Please
register
or
sign in
to post a comment