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
89455a4a
authored
2015-09-16 14:28:38 +0700
by
bank
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
change JSON lib package path for lastest version of OFBIZ
1 parent
93372177
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
src/com/brainfood/ofbiz/DirectControlServlet.java
src/com/brainfood/ofbiz/DirectControlServlet.java
View file @
89455a4
...
...
@@ -57,10 +57,8 @@ import org.ofbiz.service.DispatchContext;
import
org.ofbiz.service.LocalDispatcher
;
import
org.ofbiz.service.ModelService
;
import
org.ofbiz.service.ServiceContainer
;
import
org.apache.commons.csv.CSVFormat
;
import
org.apache.commons.csv.CSVRecord
;
import
org.apache.commons.fileupload.*
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.commons.fileupload.disk.DiskFileItem
;
...
...
@@ -70,11 +68,13 @@ import groovy.lang.GroovyClassLoader;
import
groovy.lang.Script
;
import
org.codehaus.groovy.runtime.InvokerHelper
;
import
org.ofbiz.base.json.JSON
;
import
org.ofbiz.base.conversion.JSONConverters.JSONToMap
;
import
org.ofbiz.base.lang.JSON
;
import
net.sf.json.JSONObject
;
import
net.sf.json.JsonConfig
;
import
net.sf.json.processors.JsonValueProcessor
;
import
net.sf.json.JSONSerializer
;
public
class
DirectControlServlet
extends
HttpServlet
{
public
static
final
String
module
=
DirectControlServlet
.
class
.
getName
();
...
...
@@ -159,8 +159,9 @@ public class DirectControlServlet extends HttpServlet {
if
(
"application/json"
.
equals
(
contentType
))
{
// Read request body as JSON and insert into the context
JSON
json
=
new
JSON
(
request
.
getReader
());
Map
<
String
,
Object
>
items
=
json
.
JSONObject
();
JSON
json
=
JSON
.
from
(
request
.
getReader
());
JSONToMap
jsonMap
=
new
JSONToMap
();
Map
<
String
,
Object
>
items
=
jsonMap
.
convert
(
json
);
for
(
String
key
:
items
.
keySet
())
{
context
.
put
(
key
,
items
.
get
(
key
));
}
...
...
@@ -200,8 +201,9 @@ public class DirectControlServlet extends HttpServlet {
// Check if the request is a backbone style "emulateJSON" request
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"
)));
Map
<
String
,
Object
>
items
=
json
.
JSONObject
();
JSON
json
=
JSON
.
from
(
new
StringReader
(
request
.
getParameter
(
"model"
)));
JSONToMap
jsonMap
=
new
JSONToMap
();
Map
<
String
,
Object
>
items
=
jsonMap
.
convert
(
json
);
for
(
String
key
:
items
.
keySet
())
{
if
(!
"sessionId"
.
equals
(
key
))
{
context
.
put
(
key
,
items
.
get
(
key
));
...
...
Please
register
or
sign in
to post a comment