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
27a74df2
authored
2014-09-23 16:03:31 -0500
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'BF-4169' of /home/git/repositories/brainfood/ofbiz-directcontrolservlet
2 parents
ba0e1190
405d4072
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
src/com/brainfood/ofbiz/DirectControlServlet.java
src/com/brainfood/ofbiz/DirectControlServlet.java
View file @
27a74df
...
...
@@ -97,11 +97,12 @@ public class DirectControlServlet extends HttpServlet {
}
public
void
service
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
pathInfo
=
request
.
getPathInfo
();
String
contentType
=
request
.
getContentType
();
try
{
Debug
.
logInfo
(
"getPathInfo: "
+
request
.
getPathInfo
()
+
" request.getContentType: "
+
request
.
getContentType
()
,
module
);
Debug
.
logInfo
(
"getPathInfo: "
+
pathInfo
+
" request.getContentType: "
+
contentType
,
module
);
String
pathInfo
=
request
.
getPathInfo
();
if
(
pathInfo
==
null
||
pathInfo
.
length
()
==
0
)
{
return
;
}
...
...
@@ -109,7 +110,12 @@ public class DirectControlServlet extends HttpServlet {
// Determine type of request and load the context from JSON content or
// parameter values accordingly
String
contentType
=
request
.
getContentType
();
if
(
contentType
!=
null
)
{
int
semi
=
contentType
.
indexOf
(
";"
);
if
(
semi
!=
-
1
)
{
contentType
=
contentType
.
substring
(
0
,
semi
);
}
}
// Determine the request method for service lookup and parameter filters
String
method
=
""
;
...
...
@@ -122,15 +128,15 @@ public class DirectControlServlet extends HttpServlet {
Map
<
String
,
Object
>
context
=
new
HashMap
<
String
,
Object
>();
if
(
"application/json"
.
equals
(
contentType
))
{
// Read request body as JSON and insert into the context
JSON
json
=
new
JSON
(
new
InputStreamReader
(
request
.
getInputStream
()
));
JSON
json
=
new
JSON
(
request
.
getReader
(
));
Map
<
String
,
Object
>
items
=
json
.
JSONObject
();
for
(
String
key
:
items
.
keySet
())
{
context
.
put
(
key
,
items
.
get
(
key
));
}
}
else
{
// Check if the request is a backbone style "emulateJSON" request
if
(
request
.
getContentType
()
!=
null
&&
request
.
getContentType
()
.
indexOf
(
"x-www-form-urlencoded"
)
!=
-
1
&&
if
(
contentType
!=
null
&&
contentType
.
indexOf
(
"x-www-form-urlencoded"
)
!=
-
1
&&
request
.
getParameter
(
"model"
)
!=
null
)
{
Debug
.
logInfo
(
"MODEL: "
+
request
.
getParameter
(
"model"
),
module
);
JSON
json
=
new
JSON
(
new
StringReader
(
request
.
getParameter
(
"model"
)));
...
...
Please
register
or
sign in
to post a comment