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
82e529cf
authored
2015-06-23 14:34:31 +0700
by
bank
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add content to agreement entity. [Ticket #4656][43140]
1 parent
494816c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
src/com/brainfood/ofbiz/DirectControlServlet.java
src/com/brainfood/ofbiz/PDFRenderer.java
src/com/brainfood/ofbiz/DirectControlServlet.java
View file @
82e529c
...
...
@@ -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
();
...
...
src/com/brainfood/ofbiz/PDFRenderer.java
0 → 100644
View file @
82e529c
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
);
}
}
}
Please
register
or
sign in
to post a comment