change JSON lib package path for lastest version of OFBIZ
Showing
1 changed file
with
9 additions
and
7 deletions
... | @@ -57,10 +57,8 @@ import org.ofbiz.service.DispatchContext; | ... | @@ -57,10 +57,8 @@ import org.ofbiz.service.DispatchContext; |
57 | import org.ofbiz.service.LocalDispatcher; | 57 | import org.ofbiz.service.LocalDispatcher; |
58 | import org.ofbiz.service.ModelService; | 58 | import org.ofbiz.service.ModelService; |
59 | import org.ofbiz.service.ServiceContainer; | 59 | import org.ofbiz.service.ServiceContainer; |
60 | |||
61 | import org.apache.commons.csv.CSVFormat; | 60 | import org.apache.commons.csv.CSVFormat; |
62 | import org.apache.commons.csv.CSVRecord; | 61 | import org.apache.commons.csv.CSVRecord; |
63 | |||
64 | import org.apache.commons.fileupload.*; | 62 | import org.apache.commons.fileupload.*; |
65 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; | 63 | import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
66 | import org.apache.commons.fileupload.disk.DiskFileItem; | 64 | import org.apache.commons.fileupload.disk.DiskFileItem; |
... | @@ -70,11 +68,13 @@ import groovy.lang.GroovyClassLoader; | ... | @@ -70,11 +68,13 @@ import groovy.lang.GroovyClassLoader; |
70 | import groovy.lang.Script; | 68 | import groovy.lang.Script; |
71 | 69 | ||
72 | import org.codehaus.groovy.runtime.InvokerHelper; | 70 | import org.codehaus.groovy.runtime.InvokerHelper; |
73 | import org.ofbiz.base.json.JSON; | 71 | import org.ofbiz.base.conversion.JSONConverters.JSONToMap; |
72 | import org.ofbiz.base.lang.JSON; | ||
74 | 73 | ||
75 | import net.sf.json.JSONObject; | 74 | import net.sf.json.JSONObject; |
76 | import net.sf.json.JsonConfig; | 75 | import net.sf.json.JsonConfig; |
77 | import net.sf.json.processors.JsonValueProcessor; | 76 | import net.sf.json.processors.JsonValueProcessor; |
77 | import net.sf.json.JSONSerializer; | ||
78 | 78 | ||
79 | public class DirectControlServlet extends HttpServlet { | 79 | public class DirectControlServlet extends HttpServlet { |
80 | public static final String module = DirectControlServlet.class.getName(); | 80 | public static final String module = DirectControlServlet.class.getName(); |
... | @@ -159,8 +159,9 @@ public class DirectControlServlet extends HttpServlet { | ... | @@ -159,8 +159,9 @@ public class DirectControlServlet extends HttpServlet { |
159 | 159 | ||
160 | if ("application/json".equals(contentType)) { | 160 | if ("application/json".equals(contentType)) { |
161 | // Read request body as JSON and insert into the context | 161 | // Read request body as JSON and insert into the context |
162 | JSON json = new JSON(request.getReader()); | 162 | JSON json = JSON.from(request.getReader()); |
163 | Map<String,Object> items = json.JSONObject(); | 163 | JSONToMap jsonMap = new JSONToMap(); |
164 | Map<String,Object> items = jsonMap.convert(json); | ||
164 | for (String key : items.keySet()) { | 165 | for (String key : items.keySet()) { |
165 | context.put(key, items.get(key)); | 166 | context.put(key, items.get(key)); |
166 | } | 167 | } |
... | @@ -200,8 +201,9 @@ public class DirectControlServlet extends HttpServlet { | ... | @@ -200,8 +201,9 @@ public class DirectControlServlet extends HttpServlet { |
200 | // Check if the request is a backbone style "emulateJSON" request | 201 | // Check if the request is a backbone style "emulateJSON" request |
201 | if (contentType != null && contentType.indexOf("x-www-form-urlencoded") != -1 && request.getParameter("model") != null) { | 202 | if (contentType != null && contentType.indexOf("x-www-form-urlencoded") != -1 && request.getParameter("model") != null) { |
202 | Debug.logInfo("MODEL: " + request.getParameter("model"), module); | 203 | Debug.logInfo("MODEL: " + request.getParameter("model"), module); |
203 | JSON json = new JSON(new StringReader(request.getParameter("model"))); | 204 | JSON json = JSON.from(new StringReader(request.getParameter("model"))); |
204 | Map<String,Object> items = json.JSONObject(); | 205 | JSONToMap jsonMap = new JSONToMap(); |
206 | Map<String,Object> items = jsonMap.convert(json); | ||
205 | for (String key : items.keySet()) { | 207 | for (String key : items.keySet()) { |
206 | if (!"sessionId".equals(key)) { | 208 | if (!"sessionId".equals(key)) { |
207 | context.put(key, items.get(key)); | 209 | context.put(key, items.get(key)); | ... | ... |
-
Please register or sign in to post a comment