You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by Rob LaRubbio <Ro...@BBOSmail.com> on 2007/09/27 18:20:08 UTC

Getting velocity tools to work with roller

Has anyone had any success getting velocity tools to work with roller?  My actual need is the ability to access cookies from my theme template, and velocity's CookieTool looks like it will handle that, I just haven't been able to get it working.  I saw a question about this posted some months ago, but there was no response, so I figured I'd try again.  I've attempted all of the below in both Roller3.1 and Roller4RC2

1) Add toolbox.xml* in /WEB-INF/
2) Add the following xml to web.xml for all servlet definitions:
      <init-param>
        <param-name>org.apache.velocity.toolbox</param-name>
        <param-value>/WEB-INF/toolbox.xml</param-value>
      </init-param>
3) add velocity.toolbox=/WEB-INF/toolbox.xml and
   velocity.toolbox.file=/WEB-INF/toolbox.xml to roller-customer.properties

I've also added the following tools jars to /WEB-INF/lib
velocity-tools-view-1.3.jar
velocity-tools-1.3.jar
velocity-tools-generic-1.3.jar

I've changed my logging to DEBUG, but the only reference to anything tools related is when roller reads in roller-custom.properties.  I never see it attempt to init the CookieTool, I also get no errors or exceptions.

Any thoughts?  Has anyone had more luck or have a suggestion?  Or is there a workaround that would let me test for the existence of a cookie in my Weblog.vm template?

-Rob

* This is my toolbox.xml:
<?xml version="1.0"?>
<toolbox>
  <xhtml>true</xhtml>
  <tool>
    <key>cookies</key>
    <scope>request</scope>
    <class>org.apache.velocity.tools.view.tools.CookieTool</class>
  </tool>
</toolbox>

Re: Getting velocity tools to work with roller

Posted by Dave <sn...@gmail.com>.
I have not tried this. We don't use the standard VelocityServlet to
init the template engine, so it si possible that a Roller code change
would be necessary to enable the toolbox.

- Dave


On 9/27/07, Rob LaRubbio <Ro...@bbosmail.com> wrote:
> Has anyone had any success getting velocity tools to work with roller?  My actual need is the ability to access cookies from my theme template, and velocity's CookieTool looks like it will handle that, I just haven't been able to get it working.  I saw a question about this posted some months ago, but there was no response, so I figured I'd try again.  I've attempted all of the below in both Roller3.1 and Roller4RC2
>
> 1) Add toolbox.xml* in /WEB-INF/
> 2) Add the following xml to web.xml for all servlet definitions:
>       <init-param>
>         <param-name>org.apache.velocity.toolbox</param-name>
>         <param-value>/WEB-INF/toolbox.xml</param-value>
>       </init-param>
> 3) add velocity.toolbox=/WEB-INF/toolbox.xml and
>    velocity.toolbox.file=/WEB-INF/toolbox.xml to roller-customer.properties
>
> I've also added the following tools jars to /WEB-INF/lib
> velocity-tools-view-1.3.jar
> velocity-tools-1.3.jar
> velocity-tools-generic-1.3.jar
>
> I've changed my logging to DEBUG, but the only reference to anything tools related is when roller reads in roller-custom.properties.  I never see it attempt to init the CookieTool, I also get no errors or exceptions.
>
> Any thoughts?  Has anyone had more luck or have a suggestion?  Or is there a workaround that would let me test for the existence of a cookie in my Weblog.vm template?
>
> -Rob
>
> * This is my toolbox.xml:
> <?xml version="1.0"?>
> <toolbox>
>   <xhtml>true</xhtml>
>   <tool>
>     <key>cookies</key>
>     <scope>request</scope>
>     <class>org.apache.velocity.tools.view.tools.CookieTool</class>
>   </tool>
> </toolbox>
>