[
https://issues.apache.org/jira/browse/VELTOOLS-94?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554459
]
Nathan Bubna commented on VELTOOLS-94:
--------------------------------------
Be sure to use o.a.v.t.view.ServletUtils.getVelocityView(ServletConfig config)
to get a VelocityView for a filter to use, unless you explicitly do not want to
share your VelocityView across a ServletContext for some reason.
Also, the VelocityView(ServletContext) ctor is not meant to init. a
ServletConfig is required for full init (or you can use the separate init
methods), ask me if you want more of my thoughts on this. i'm currently tight
on time. use VelocityView(ServletConfig) if you want to create and init in the
same step.
I'm not entirely sure what you are trying to accomplish in #2 and #3 above. i
may just not have the time to think it through. there probably is already a
way to do it, but i may have missed something. in general, if you want to add
tool properties, you should be adding them via a FactoryConfiguration. we can
streamline that and make such late configuration additions easier, but any
change to the factory should go through the configure() method at this point.
i might be open to changing that, but would require some convincing. :)
It would be nice to make it easier to subclass VV. i'm definitely open to
making that possible.
> Document standard use cases with J2EE filters
> ---------------------------------------------
>
> Key: VELTOOLS-94
> URL: https://issues.apache.org/jira/browse/VELTOOLS-94
> Project: Velocity Tools
> Issue Type: Improvement
> Components: Documentation
> Affects Versions: 2.0
> Environment: all
> Reporter: Claude Brisson
> Priority: Minor
>
> (yet another docs reminder...)
> There are some use cases concerning J2EE filters that I'd like to
> address/document before releasing 2.0 final:
> 1. sharing the VelocityView with filters - made very easy in 2.x, using:
> view = (VelocityView)servletContext.getAttribute(VelocityView.class.getName())
> but the loat-a-startup flag must be set on the servlets for the view to be
> initialized at the time the filter is called.
> [BTW, the VelocityView(ServletContext) exists but is not yet fully coded -
> init is not yet called. We should either comment it for now or refactor
> VV.init/configure to work either with a ServletConfig or ServletContext.
> Personally I don't need it at all.]
> 2. having a filter add objects in the context: very easy, objects should be
> put in targeted scopes using request/session/application attributes.
> 3. having a filter add a tools property (that will be added to newly created
> request/session tools using bean setters or configure): I'm not really sure
> about this one. With the current codebase, it is necessary to subclass both
> the VV and the ToolboxFactory to circumvent protected accesses to be able to
> do sthing like this:
> VV.getToolboxFactory().putProperties(scope,props)
> I'd vote for having those two methods made public.
> [BTW, subclassing of the VV also requires for now the subclassing of the
> VVS... maybe ServletUtils.getVelocityView could check a configuration
> property like "velocity.tools.view.class=" containing the classname of the
> VelocityView subclass to be used]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]