You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by David Just <da...@visionsolutions.com> on 2009/07/16 20:27:50 UTC

Access a Jetspeed service in the decorator.vm

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

 

Thanks,

Dave.



David Just l Software Engineer l Vision Solutions l +1 (507) 529-5939 l david.just@visionsolutions.com
The contents of this e-mail (and any attachments) are privileged and confidential. Unauthorized use is strictly prohibited.

RE: Access a Jetspeed service in the decorator.vm

Posted by David Just <da...@visionsolutions.com>.
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.just@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.taylor@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-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org


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


Re: Access a Jetspeed service in the decorator.vm

Posted by David Sean Taylor <d....@onehippo.com>.
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-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org