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
11f2b42c
authored
2016-08-25 16:01:59 -0500
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'BF-7593' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet
2 parents
a72036e1
6591e7b0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
12 deletions
src/com/brainfood/ofbiz/DirectControlServlet.java
src/com/brainfood/ofbiz/DirectControlServlet.java
View file @
11f2b42
...
...
@@ -75,6 +75,7 @@ import org.ofbiz.entity.condition.EntityCondition;
import
org.ofbiz.service.DispatchContext
;
import
org.ofbiz.service.LocalDispatcher
;
import
org.ofbiz.service.ModelService
;
import
org.ofbiz.service.ServiceAuthException
;
import
org.ofbiz.service.ServiceContainer
;
import
org.apache.commons.csv.CSVFormat
;
...
...
@@ -247,6 +248,11 @@ public class DirectControlServlet extends HttpServlet {
processRequest
();
}
catch
(
IOException
e
)
{
throw
e
;
}
catch
(
ServiceAuthException
e
)
{
e
.
printStackTrace
();
Debug
.
logError
(
e
,
"ServiceAuthException"
,
module
);
response
.
setStatus
(
401
);
setResponseNoCache
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
(
IOException
)
new
IOException
(
e
.
getMessage
()).
initCause
(
e
);
...
...
@@ -265,6 +271,20 @@ public class DirectControlServlet extends HttpServlet {
return
file
;
}
protected
void
setResponseNoCache
()
{
// 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"
);
}
protected
void
processRequest
()
throws
Exception
{
Map
<
String
,
Object
>
context
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -396,7 +416,7 @@ public class DirectControlServlet extends HttpServlet {
// prolong the session
if
(
UtilValidate
.
isNotEmpty
(
checkSessionService
))
{
dispatcher
.
runSync
(
checkSessionService
,
UtilMisc
.<
String
,
Object
>
toMap
(
"
authS
essionId"
,
authToken
,
"userLogin"
,
userLogin
));
dispatcher
.
runSync
(
checkSessionService
,
UtilMisc
.<
String
,
Object
>
toMap
(
"
s
essionId"
,
authToken
,
"userLogin"
,
userLogin
));
}
}
}
...
...
@@ -426,17 +446,7 @@ public class DirectControlServlet extends HttpServlet {
}
response
.
setStatus
(
statusCode
);
// 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"
);
setResponseNoCache
();
if
(
"JSON"
.
equals
(
outputHandler
))
{
response
.
setContentType
(
"application/x-json"
);
...
...
Please
register
or
sign in
to post a comment