ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ritesh Trivedi <ritesh.triv...@gmail.com>
Subject Re: How is request passed to groovy scripts?
Date Sat, 04 Oct 2008 18:19:59 GMT

Joe,

Thanks for pointing that out - but sendMailFromScreen is not calling that
method, it calls the populateContextForService method. OrderConfirmEmail
actually gets sent from service (OrderServices.java) and yet the groovy
script in OrderStatus uses request object without any errors. So it seems
that someone is passing request object explicity as bodyParameter but I cant
find it.



Joe Eckard wrote:
> 
> Check the populateContextForRequest method in /framework/widget/src/ 
> org/ofbiz/widget/screen/ScreenRenderer.java, I believe this is what  
> you're looking for.
> 
> -Joe
> 
> On Oct 4, 2008, at 1:43 AM, Ritesh Trivedi wrote:
> 
>>
>> I guess I could have been bit more clear in asking the question...
>>
>> I actually meant request object (HttpServletRequest) passed to the  
>> groovy
>> script. As it seems like its an implicit object or getting passed  
>> somehow
>> that I cant figure out.
>>
>> I will try to be more explicit. I am calling sendEmailFromScreen  
>> service and
>> passing it one of the screen names.
>>
>> Here is the screen definition
>> <screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>
>> xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-screen.xsd 
>> ">
>>    <screen name="EmailFullCart">
>>        <section>
>>            <actions>
>>                <set field="titleProperty"  
>> value="PageTitleShoppingCart"/>
>>                <set field="headerItem" value="Shopping Cart"/>
>>                <script
>> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/ 
>> cart/ShowCart.groovy"/>
>>                <script
>> location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/ 
>> cart/ShowPromoText.groovy"/>
>>            </actions>
>>            <widgets>
>>                <platform-specific><html><html-template
>> location="component://neobits/webapp/neobits/cart/showcart.ftl"/></ 
>> html></platform-specific>
>>            </widgets>
>>        </section>
>>    </screen>
>> </screens>
>>
>> As you can see one of the actions is ShowCart.groovy which is an  
>> existing
>> groovy script in ecommerce demo app and here is the first line of that
>> script
>>
>> // Get the Cart and Prepare Size
>> shoppingCart = ShoppingCartEvents.getCartObject(request);
>>
>> I get request property not set for ShowCart error while passing this  
>> screen
>> to be rendered with sendMailFromScreen from my java code.
>>
>> So my original question was how is request object passed to Groovy  
>> script,
>> Looking at the existing calls it doesnt look like it is passed in the
>> context while calling the service or is it done by  
>> ServiceEventHandler. Can
>> someone more familiar with the topic shed some light?
>>
>>
>> King-of-mabs wrote:
>>>
>>> Hi ,
>>> I am not confirm but let you check this that whether you set  
>>> property for
>>> your groovy file or not. and So then please post your console or  
>>> screen
>>> error in mail.
>>>
>>>
>>> Regards
>>> Ravindra Mandre
>>> Indore
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-is-request-passed-to-groovy-scripts--tp19808550p19809275.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
> 
> 
>  
> 

-- 
View this message in context: http://www.nabble.com/How-is-request-passed-to-groovy-scripts--tp19808550p19815152.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Mime
View raw message