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
6235725a
authored
2014-04-24 11:42:08 -0500
by
Jerry Pommer
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'BF-2755' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet
2 parents
15b9531c
2c98ab02
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
src/com/brainfood/ofbiz/DirectControlServlet.java
src/com/brainfood/ofbiz/DirectControlServlet.java
View file @
6235725
...
...
@@ -111,14 +111,12 @@ public class DirectControlServlet extends HttpServlet {
// Build context
Map
<
String
,
Object
>
context
=
new
HashMap
<
String
,
Object
>();
String
authToken
=
null
;
String
paramList
=
""
;
for
(
Iterator
<
String
>
k
=
request
.
getParameterMap
().
keySet
().
iterator
();
k
.
hasNext
();
)
{
paramList
+=
" "
+
k
.
next
();
}
Debug
.
logInfo
(
"PARAMETERS: "
+
request
.
getParameterMap
()
,
module
);
Debug
.
logInfo
(
"PARAMETERS: "
+
paramList
,
module
);
// Handle if this is a form post
String
contentType
=
request
.
getContentType
();
if
(
contentType
!=
null
&&
contentType
.
indexOf
(
"x-www-form-urlencoded"
)
!=
-
1
)
{
...
...
@@ -128,25 +126,23 @@ public class DirectControlServlet extends HttpServlet {
Debug
.
logInfo
(
"Method: HTTP("
+
httpMethod
+
") embedded("
+
method
+
")"
,
module
);
if
(
method
==
null
)
method
=
"GET"
;
// If this is a backbone PUT/DELETE emulated call then handle it
if
(
"PUT"
.
equals
(
method
)
||
"DELETE"
.
equals
(
method
)
||
"CALL"
.
equals
(
method
)
||
"POST"
.
equals
(
method
)
)
{
if
(
request
.
getParameter
(
"model"
)
!=
null
)
{
// if (!"CALL".equals(method)) context.put("_method", method);
JSON
json
=
new
JSON
(
new
StringReader
(
request
.
getParameter
(
"model"
)));
Map
<
String
,
Object
>
items
=
json
.
JSONObject
();
authToken
=
(
String
)
items
.
get
(
"sessionId"
);
for
(
String
key
:
items
.
keySet
())
{
if
(!
"sessionId"
.
equals
(
key
)
&&
!
"_method"
.
equals
(
key
))
{
context
.
put
(
key
,
items
.
get
(
key
));
Debug
.
logInfo
(
"parameter '"
+
key
+
"'="
+
items
.
get
(
key
),
module
);
Debug
.
logInfo
(
"
>
parameter '"
+
key
+
"'="
+
items
.
get
(
key
),
module
);
}
}
}
else
{
authToken
=
request
.
getParameter
(
"sessionId"
);
for
(
Enumeration
<
String
>
params
=
request
.
getParameterNames
();
params
.
hasMoreElements
();)
{
String
param
=
params
.
nextElement
();
Object
[]
values
=
request
.
getParameterValues
(
param
);
if
(!
"sessionId"
.
equals
(
param
)
&&
!
"_method"
.
equals
(
param
))
{
context
.
put
(
param
,
values
.
length
==
1
?
values
[
0
]
:
values
);
Debug
.
logInfo
(
"parameter '"
+
param
+
"'="
+
context
.
get
(
param
),
module
);
Debug
.
logInfo
(
"
!
parameter '"
+
param
+
"'="
+
context
.
get
(
param
),
module
);
}
}
}
...
...
@@ -177,6 +173,7 @@ public class DirectControlServlet extends HttpServlet {
// If the sessionId parameter is set, attempt to look up the corresponding
// UserLogin and apply it to the service context
String
authToken
=
request
.
getParameter
(
"sessionId"
);
if
(
authToken
!=
null
)
{
GenericValue
authTokenEntity
=
EntityUtil
.
getFirst
(
delegator
.
findList
(
"Visit"
,
...
...
@@ -198,6 +195,8 @@ public class DirectControlServlet extends HttpServlet {
}
}
Debug
.
logInfo
(
"USERLOGIN "
+
context
.
get
(
"userLogin"
)
+
" AUTHTOKEN "
+
authToken
,
module
);
// some needed info for when running the service
Locale
locale
=
UtilHttp
.
getLocale
(
request
);
TimeZone
timeZone
=
UtilHttp
.
getTimeZone
(
request
);
...
...
Please
register
or
sign in
to post a comment