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