Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Syretta Man
simplewebapp
Commits
4de544c5
Commit
4de544c5
authored
Jan 16, 2020
by
Syretta Man
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add try catch
parent
b4a09549
Pipeline
#113014
passed with stages
in 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
src/main/java/ic/doc/WebServer.java
src/main/java/ic/doc/WebServer.java
+8
-2
No files found.
src/main/java/ic/doc/WebServer.java
View file @
4de544c5
...
...
@@ -94,13 +94,19 @@ public class WebServer {
bw
.
close
();
resp
.
setContentType
(
"application/pdf"
);
resp
.
setHeader
(
"Content-disposition"
,
"attachment; filename=
haha
.pdf"
);
resp
.
setHeader
(
"Content-disposition"
,
"attachment; filename=
anything
.pdf"
);
String
path
=
file
.
getAbsolutePath
();
ProcessBuilder
pb
=
new
ProcessBuilder
(
"bash"
,
"-c"
,
"pandoc -s -o answer.pdf "
+
path
);
// String[] cm = {"pandoc", "-s", "-o", "sample.pdf", "answer.md"};
// pb.command(cm);
pb
.
start
();
Process
process
=
pb
.
start
();
try
{
process
.
waitFor
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
try
(
InputStream
in
=
new
FileInputStream
(
"answer.pdf"
);
OutputStream
out
=
resp
.
getOutputStream
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment