You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/11/14 12:15:54 UTC
svn commit: r1639606 -
/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
Author: jleroux
Date: Fri Nov 14 11:15:54 2014
New Revision: 1639606
URL: http://svn.apache.org/r1639606
Log:
A patch from Pierre Gaudin for "use requestParameters for customMethod call" https://issues.apache.org/jira/browse/OFBIZ-5822
For a content, you can set a custom method that perform an action before content's rendering.
Unfortunately, in the customMethod call, the request Parameters can't be used because they are not set into the map that is used to create custom method IN parameters.
This patch solves this problem
Modified:
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=1639606&r1=1639605&r2=1639606&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Fri Nov 14 11:15:54 2014
@@ -189,6 +189,8 @@ public class ContentWorker implements or
DispatchContext dctx = dispatcher.getDispatchContext();
ModelService service = dctx.getModelService(serviceName);
if (service != null) {
+ //put all requestParameters into templateContext to use them as IN service parameters
+ templateContext.putAll((Map<String, Object>)templateContext.get("requestParameters"));
Map<String,Object> serviceCtx = service.makeValid(templateContext, ModelService.IN_PARAM);
Map<String,Object> serviceRes;
try {
Re: svn commit: r1639606 -
/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWork
er.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Scott, I will improve that soon
Jacques
Le 15/11/2014 11:52, Scott Gray a écrit :
> It's probably not a good idea to modify the templateContext map in this
> way, it isn't used only in this method and I don't think you've considered
> the implications. It would be better to prepare a new map to use in the
> service call.
>
> Regards
> Scott
>
> On Sat, Nov 15, 2014 at 12:15 AM, <jl...@apache.org> wrote:
>
>> Author: jleroux
>> Date: Fri Nov 14 11:15:54 2014
>> New Revision: 1639606
>>
>> URL: http://svn.apache.org/r1639606
>> Log:
>> A patch from Pierre Gaudin for "use requestParameters for customMethod
>> call" https://issues.apache.org/jira/browse/OFBIZ-5822
>>
>> For a content, you can set a custom method that perform an action before
>> content's rendering.
>> Unfortunately, in the customMethod call, the request Parameters can't be
>> used because they are not set into the map that is used to create custom
>> method IN parameters.
>> This patch solves this problem
>>
>> Modified:
>>
>> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
>>
>> Modified:
>> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=1639606&r1=1639605&r2=1639606&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
>> (original)
>> +++
>> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
>> Fri Nov 14 11:15:54 2014
>> @@ -189,6 +189,8 @@ public class ContentWorker implements or
>> DispatchContext dctx = dispatcher.getDispatchContext();
>> ModelService service = dctx.getModelService(serviceName);
>> if (service != null) {
>> + //put all requestParameters into templateContext to use
>> them as IN service parameters
>> + templateContext.putAll((Map<String,
>> Object>)templateContext.get("requestParameters"));
>> Map<String,Object> serviceCtx =
>> service.makeValid(templateContext, ModelService.IN_PARAM);
>> Map<String,Object> serviceRes;
>> try {
>>
>>
>>
Re: svn commit: r1639606 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
Posted by Scott Gray <sc...@hotwaxmedia.com>.
It's probably not a good idea to modify the templateContext map in this
way, it isn't used only in this method and I don't think you've considered
the implications. It would be better to prepare a new map to use in the
service call.
Regards
Scott
On Sat, Nov 15, 2014 at 12:15 AM, <jl...@apache.org> wrote:
> Author: jleroux
> Date: Fri Nov 14 11:15:54 2014
> New Revision: 1639606
>
> URL: http://svn.apache.org/r1639606
> Log:
> A patch from Pierre Gaudin for "use requestParameters for customMethod
> call" https://issues.apache.org/jira/browse/OFBIZ-5822
>
> For a content, you can set a custom method that perform an action before
> content's rendering.
> Unfortunately, in the customMethod call, the request Parameters can't be
> used because they are not set into the map that is used to create custom
> method IN parameters.
> This patch solves this problem
>
> Modified:
>
> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
>
> Modified:
> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=1639606&r1=1639605&r2=1639606&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
> (original)
> +++
> ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
> Fri Nov 14 11:15:54 2014
> @@ -189,6 +189,8 @@ public class ContentWorker implements or
> DispatchContext dctx = dispatcher.getDispatchContext();
> ModelService service = dctx.getModelService(serviceName);
> if (service != null) {
> + //put all requestParameters into templateContext to use
> them as IN service parameters
> + templateContext.putAll((Map<String,
> Object>)templateContext.get("requestParameters"));
> Map<String,Object> serviceCtx =
> service.makeValid(templateContext, ModelService.IN_PARAM);
> Map<String,Object> serviceRes;
> try {
>
>
>