You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Paul Moore <pa...@gmail.com> on 2013/10/11 19:06:13 UTC

How to set global properties

Hi,

I am working on integrating Velocity with Jersey 2.x and am having some
trouble setting the value of a global property, specifically
ViewToolManager's 'createSession'.

Essentially, I am establishing a VelocityView configured from an
ExtendedProperties object.  The toolbox config is being parsed into a
PropertiesFactoryConfiguration and being made available at the expected
servlet location.

The tool configuration works fine, e.g.

ve.addProperty("tools.toolbox", "request,session");
ve.addProperty("tools.request.example",
"org.glassfish.jersey.examples.velocity.tools.ExampleTool");

but I can't find a way to configure global properties (of which
createSession is one - see ViewToolManager.getCreateSession().

I've tried the following syntax, located in various parts of the
documentation:

tools.session.property.create-session = true
tools.session.property.create-session.type = boolean
tools.session.map = java.util.HashMap


but this (reasonably) sets 'session' scoped properties.

I think I need to set the property at the 'tools' level, but have tried the
following without success:

 tools.property.create-session = true
 tools.property.createSession = true

Can anybody suggest what the path syntax of global properties should be?

Many thanks

Paul

Re: How to set global properties

Posted by Paul Moore <pa...@gmail.com>.
As always, writing it down helped clarify the issue.

The required path is:

tools.property.createSession = true

The reason I was having trouble is because I'd left a rogue 'session' in
the "tools.toolbox" configuration... schoolboy.

Paul


On 11 October 2013 18:06, Paul Moore <pa...@gmail.com> wrote:

> Hi,
>
> I am working on integrating Velocity with Jersey 2.x and am having some
> trouble setting the value of a global property, specifically
> ViewToolManager's 'createSession'.
>
> Essentially, I am establishing a VelocityView configured from an
> ExtendedProperties object.  The toolbox config is being parsed into a
> PropertiesFactoryConfiguration and being made available at the expected
> servlet location.
>
> The tool configuration works fine, e.g.
>
> ve.addProperty("tools.toolbox", "request,session");
> ve.addProperty("tools.request.example",
> "org.glassfish.jersey.examples.velocity.tools.ExampleTool");
>
> but I can't find a way to configure global properties (of which
> createSession is one - see ViewToolManager.getCreateSession().
>
> I've tried the following syntax, located in various parts of the
> documentation:
>
> tools.session.property.create-session = true
> tools.session.property.create-session.type = boolean
> tools.session.map = java.util.HashMap
>
>
> but this (reasonably) sets 'session' scoped properties.
>
> I think I need to set the property at the 'tools' level, but have tried
> the following without success:
>
>  tools.property.create-session = true
>  tools.property.createSession = true
>
> Can anybody suggest what the path syntax of global properties should be?
>
> Many thanks
>
> Paul
>