Thank you,  that's exactly what I'm looking for, however I have another
question:  Where do I define the bean that's referenced in the
request-context-objects.xml ?  I'd like to add my own custom spring
context file into Jetspeed how can I do that.

Thanks again,
Dave



David Just l Software Engineer l Vision Solutions l +1 (507) 529-5939 l 
david.j...@visionsolutions.com
The contents of this e-mail (and any attachments) are privileged and 
confidential. Unauthorized use is strictly prohibited.
-----Original Message-----
From: David Sean Taylor [mailto:d.tay...@onehippo.com] 
Sent: Monday, July 20, 2009 8:30 PM
To: Jetspeed Users List
Subject: Re: Access a Jetspeed service in the decorator.vm


On Jul 16, 2009, at 11:27 AM, David Just wrote:

> I would like to create a Jetspeed service that is then used by the
> decorator.vm macros to put dynamic data in the navigation menu.  I
> understand how to create and access services at the portlet level, but
> cannot find any documentation on how to make the service accessible to
> the velocity templates for the theme.   Is this possible?  What
> configuration do I have to change.
>
>
>
> Jetspeed 2.2 , Tomcat 6.0
>
  One solution would be to use the Jetspeed Request Context. In your  
decorator, you can access a user-configured Spring bean, in this  
example named "dynamicDataService" with:

#set ($myService = $rco.get("dynamicDataService"))

and then just use the service to access a getter named getDynamicData  
for example:

$myService.DynamicData()

You also need to configure it in Spring by overriding the request- 
context-objects.xml:

<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
">

   <!--  Request Context Objects will be populated into the Jetspeed  
Request Context
     and are accessible in the vm context of templates in the "rco"  
variable, example:
     $rco.get("myObject")
   -->
   <bean id="RequestContextObjects" class="java.util.HashMap">
     <meta key="j2:cat" value="default" />
     <constructor-arg index="0">
       <map>
           <entry key="dynamicDataService">
           <ref bean="org.just.david.DynamicDataService" />
           </entry>
       </map>
     </constructor-arg>
   </bean>
</beans>

Remember to deploy the DynamicDataService jar to your jetspeed portal  
context (WEB-INF/lib) in your custom build

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org
For additional commands, e-mail: jetspeed-user-h...@portals.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org
For additional commands, e-mail: jetspeed-user-h...@portals.apache.org

Reply via email to