Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
java-nginx-upload-processor
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
c6e31085
authored
2014-01-20 16:06:43 -0600
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Do not change status to "done" until the OFBiz service call returns
1 parent
707be16d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
src/com/brainfood/servlet/NGINXUploadProcessor.java
src/com/brainfood/servlet/NGINXUploadProcessor.java
View file @
c6e3108
...
...
@@ -19,6 +19,7 @@ import org.ofbiz.base.util.HttpClient;
public
class
NGINXUploadProcessor
extends
HttpServlet
{
class
ProgressRecord
{
boolean
complete
=
false
;
long
bytesRead
;
long
contentLength
;
int
items
;
...
...
@@ -65,12 +66,8 @@ public class NGINXUploadProcessor extends HttpServlet {
System
.
err
.
println
(
"QUERY PROGRESS: ["
+
xProgressId
+
"] - "
+
progress
.
get
(
xProgressId
));
if
(
xProgressId
!=
null
&&
progress
.
get
(
xProgressId
)
!=
null
)
{
ProgressRecord
record
=
progress
.
get
(
xProgressId
);
String
status
=
"done"
;
if
(
record
.
bytesRead
<
record
.
contentLength
)
{
status
=
"uploading"
;
}
out
.
println
(
"({ \"state\" : \""
+
status
+
"\", \"received\" : "
+
record
.
bytesRead
+
", \"size\" : "
+
record
.
contentLength
+
" });"
);
out
.
println
(
"({ \"state\" : \""
+
(
record
.
complete
?
"done"
:
"uploading"
)
+
"\", \"received\" : "
+
record
.
bytesRead
+
", \"size\" : "
+
record
.
contentLength
+
" });"
);
}
else
{
out
.
println
(
"({ \"error\" : \"Invalid X-Progress-ID\" });"
);
}
...
...
@@ -132,6 +129,8 @@ public class NGINXUploadProcessor extends HttpServlet {
String
pResponse
=
http
.
post
();
System
.
err
.
println
(
"FINISHED:"
+
pResponse
);
out
.
print
(
pResponse
);
progress
.
get
(
xProgressId
).
complete
=
true
;
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
...
...
Please
register
or
sign in
to post a comment