From a41df15216cd9c53a4b29250d56b8e9a9985293b Mon Sep 17 00:00:00 2001 From: Marcel Groeneweg Date: Thu, 22 Nov 2018 12:59:11 +0100 Subject: [PATCH 1/2] Post using string Added method to post a string rather than a Mendix object. Also added body logging when asFormData is true. Added test page to the --- RestServices.mpr | Bin 8513536 -> 8513536 bytes .../restservices/actions/postString.java | 51 ++++++++++++++++++ .../restservices/consume/RestConsumer.java | 24 +++++++-- javasource/system/UserActionsRegistrar.java | 1 + 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 javasource/restservices/actions/postString.java diff --git a/RestServices.mpr b/RestServices.mpr index 257450b733acd7bfd574193bac2e7358c6a6fdaa..2522117e55b66fe098934a0de4084d3a415d10a1 100644 GIT binary patch delta 18613 zcmeHv2V7HE-+%7CAp$~jV*tYn0a4k3u!4dT!VW8dEEPqF4B3R~AVCf8g>n>8p$>3^ z>!PB9+d2xaTD2CfvsFv0)mqp8++Yhq`@YZn{Gb27efqq7`t>F!zq5Yl+}}FCQ+Y=v zRSvPlSXV-!aLXtZx*>%!fU?xe9g#Fo+&EkV^Q2&&fO!qsUPV|n=ujx=XLfe>no`}C ziB;`Zj=O8DKSOlt?J=#M(smQF)ImHsIG*pwD~k#DwH=csij2&h!t)nK2=bGC^2(fJ zoe~PmQUs;ZQDsRIuRy%Y%zCsjg&HN5$Wv8)W0P0Rb zU!v|nu@#9$(dymOj*E!y8GQ}yo{kkuGODsW938@g1zEy`l-LrVjEtCUU;kK%sF;@# z;2I?0Wo0GB3;i5RWjxy{CF!Y-UOdaHa~ob*+IuW{2_=6L0JoBMxoeTz2@|3-*t(pi1gnDuf0E zt%3S>fS5j%QbD2Yzz)O5N^BXx12uz)v4NUHF)RJ_C+0=f%i_l^3Lj}F-FmzMA=@1L zQ%i(*T~_G2ANO=#*0*cNLMj`@nh;tL+7JUFbRcwzMlpR{2)&n8PLyNjAi{*1w0l9P zJ%XBYL6<2r0KH^J=u;W`C>73fGhstxe2EZyA88F$6>O<`e`^R~s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Ud;di diff --git a/javasource/restservices/actions/postString.java b/javasource/restservices/actions/postString.java new file mode 100644 index 0000000..7f7c6b4 --- /dev/null +++ b/javasource/restservices/actions/postString.java @@ -0,0 +1,51 @@ +// This file was generated by Mendix Modeler. +// +// WARNING: Only the following code will be retained when actions are regenerated: +// - the import list +// - the code between BEGIN USER CODE and END USER CODE +// - the code between BEGIN EXTRA CODE and END EXTRA CODE +// Other code you write will be lost the next time you deploy the project. +// Special characters, e.g., é, ö, à, etc. are supported in comments. + +package restservices.actions; + +import com.mendix.systemwideinterfaces.core.IContext; +import com.mendix.systemwideinterfaces.core.IMendixObject; +import com.mendix.webui.CustomJavaAction; +import restservices.consume.RestConsumer; +import restservices.proxies.HttpMethod; + +public class postString extends CustomJavaAction +{ + private java.lang.String collectionUrl; + private java.lang.String requestData; + private java.lang.Boolean submitAsFormData; + + public postString(IContext context, java.lang.String collectionUrl, java.lang.String requestData, java.lang.Boolean submitAsFormData) + { + super(context); + this.collectionUrl = collectionUrl; + this.requestData = requestData; + this.submitAsFormData = submitAsFormData; + } + + @Override + public IMendixObject executeAction() throws Exception + { + // BEGIN USER CODE + return RestConsumer.request(getContext(), HttpMethod.POST, collectionUrl, null, null, submitAsFormData, requestData).getMendixObject(); + // END USER CODE + } + + /** + * Returns a string representation of this action + */ + @Override + public java.lang.String toString() + { + return "postString"; + } + + // BEGIN EXTRA CODE + // END EXTRA CODE +} diff --git a/javasource/restservices/consume/RestConsumer.java b/javasource/restservices/consume/RestConsumer.java index 5f65bdc..6585a3e 100644 --- a/javasource/restservices/consume/RestConsumer.java +++ b/javasource/restservices/consume/RestConsumer.java @@ -447,8 +447,15 @@ public Boolean apply(IMendixObject item) { }); } + // Marcel Groeneweg Overload to keep existing stuff running OK. public static RequestResult request(final IContext context, HttpMethod method, String url, final IMendixObject source, final IMendixObject target, final boolean asFormData) throws Exception { + return request(context, method, url, source, target, asFormData, null); + } + + // Marcel Groeneweg Added requestData parameter + public static RequestResult request(final IContext context, HttpMethod method, String url, + final IMendixObject source, final IMendixObject target, final boolean asFormData, final String requestData) throws Exception { lastConsumeError.set(null); if (context == null) @@ -468,9 +475,15 @@ public static RequestResult request(final IContext context, HttpMethod method, S Map params = new HashMap(); RequestEntity requestEntity = null; - final JSONObject data = source == null ? null : JsonSerializer.writeMendixObjectToJson(context, source, false); + // Marcel Groeneweg use requestData string if available, use existing logic otherwise. + final JSONObject data; + if (requestData != null) { + data = new JSONObject(requestData); + } else { + data = source == null ? null : JsonSerializer.writeMendixObjectToJson(context, source, false); + } - boolean appendDataToUrl = source != null && (asFormData || method == HttpMethod.GET || method == HttpMethod.DELETE); + boolean appendDataToUrl = (source != null || requestData != null) && (asFormData || method == HttpMethod.GET || method == HttpMethod.DELETE); url = updateUrlPathComponentsWithParams(url, appendDataToUrl, isFileSource, data, params); //Setup request entity for file @@ -480,8 +493,13 @@ public static RequestResult request(final IContext context, HttpMethod method, S else if (source != null && asFormData && (isFileSource || hasFileParts)) { requestEntity = buildMultiPartEntity(context, source, params); } - else if (asFormData && !isFileSource) + else if (asFormData && !isFileSource) { requestHeaders.put(RestServices.HEADER_CONTENTTYPE, RestServices.CONTENTTYPE_FORMENCODED); + // Marcel Groeneweg also log body here. + if (RestServices.LOGCONSUME.isDebugEnabled()) { + RestServices.LOGCONSUME.debug("[Body JSON Data] " + data.toString()); + } + } else if (data != null && data.length() != 0) { requestEntity = new StringRequestEntity(data.toString(4), RestServices.CONTENTTYPE_APPLICATIONJSON, RestServices.UTF8); if (RestServices.LOGCONSUME.isDebugEnabled()) { diff --git a/javasource/system/UserActionsRegistrar.java b/javasource/system/UserActionsRegistrar.java index 5c1b920..abd2695 100644 --- a/javasource/system/UserActionsRegistrar.java +++ b/javasource/system/UserActionsRegistrar.java @@ -132,6 +132,7 @@ public void registerActions(IActionRegistrator registrator) registrator.registerUserAction(restservices.actions.LoadService.class); registrator.registerUserAction(restservices.actions.post.class); registrator.registerUserAction(restservices.actions.post2.class); + registrator.registerUserAction(restservices.actions.postString.class); registrator.registerUserAction(restservices.actions.postWithResult.class); registrator.registerUserAction(restservices.actions.publishDelete.class); registrator.registerUserAction(restservices.actions.publishUpdate.class); From f04bcfcb186ef51eb03e7aa904fcc1666c3fa524 Mon Sep 17 00:00:00 2001 From: Marcel Groeneweg Date: Mon, 26 Nov 2018 11:14:43 +0100 Subject: [PATCH 2/2] Fix null pointer exception The new log could cause a null pointer exception if the data was null. --- javasource/restservices/consume/RestConsumer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javasource/restservices/consume/RestConsumer.java b/javasource/restservices/consume/RestConsumer.java index 6585a3e..3dd14f6 100644 --- a/javasource/restservices/consume/RestConsumer.java +++ b/javasource/restservices/consume/RestConsumer.java @@ -496,7 +496,7 @@ else if (source != null && asFormData && (isFileSource || hasFileParts)) { else if (asFormData && !isFileSource) { requestHeaders.put(RestServices.HEADER_CONTENTTYPE, RestServices.CONTENTTYPE_FORMENCODED); // Marcel Groeneweg also log body here. - if (RestServices.LOGCONSUME.isDebugEnabled()) { + if (RestServices.LOGCONSUME.isDebugEnabled() && data != null) { RestServices.LOGCONSUME.debug("[Body JSON Data] " + data.toString()); } }