Re: svn commit: r1639606 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1639606 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java

Scott Gray-2
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, <[hidden email]> 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 {
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1639606 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWork er.java

Jacques Le Roux
Administrator
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, <[hidden email]> 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 {
>>
>>
>>