Thanks for looking at this Steve. If you figure out a better way of
doing this, please let me know. In the meantime you may want to enter
a bug for it. There's many open issues on SourceForge and I'm hoping
to move them to http://issues.appfuse.org in the near future - there's
a Struts Menu project on that site.
Matt
On 2/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Looks like the code in
> net.sf.navigator.displayer.VelocityMenuDisplayer.init() does a bit of
> setup, checks for the existence of an overriding velocity.properties
> resource bundle, does a bit of looping to set up a new Properties, and then
> calls Velocity.init each time the menu is being loaded:
>
>
> // MR: Copied from VelocityViewServlet to initialize
> WebappLoader
> Velocity.setApplicationAttribute(SERVLET_CONTEXT_KEY,
> pageContext
> .getServletContext());
>
> // default to servletlogger, which logs to the servlet
> engines log
>
> Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
> ServletLogger.class.getName());
>
> // by default, load resources with webapp resource loader
> Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER,
> "webapp");
> Velocity.setProperty("webapp.resource.loader.class",
> WebappLoader.class.getName());
>
> // now all is ready - init Velocity
> try {
> // look to see if the user has overridden
> velocity.properties by
> // placing velocity.properties in WEB-INF/classes
> ResourceBundle rb = null;
>
> try {
> rb = ResourceBundle.getBundle("velocity");
> log.debug("got custom velocity.properties
> resource bundle");
> } catch (MissingResourceException mre) {
> // use default
> rb = ResourceBundle
> .getBundle
> ("net.sf.navigator.displayer.velocity");
> log.debug("using default velocity.properties
> resource bundle");
> }
>
> Properties props = new Properties();
>
> for (Enumeration keys = rb.getKeys();
> keys.hasMoreElements();) {
> String key = (String) keys.nextElement();
> props.put(key, rb.getString(key));
> }
>
> // only initialized the first time it's called,
> from:
> //
> http://jakarta.apache.org/velocity/developer-guide.html
> // it's ignored for subsequent calls
> Velocity.init(props);
>
> } catch (Exception e) {
> log.error("Error initializing Velocity: " +
> e.getMessage());
> e.printStackTrace();
> }
>
> I assume Velocity.init gets cached internally, but reading of the resource
> bundle, creating the Properties, etc is getting done each time.
>
> Matt, when you get time, you may want to look at this.
>
>
> Steve
>
>
>
> ______________________________________________________________________
>
> ----ONLINE-SERVICES-------------------------------------------
> Find out more about our services or login at
> http://www.scottishequitable.co.uk
>
> -----EXISTING-BUSINESS-CONTACTS-------------------------------
> 08456 10 00 10 Pensions & investments ([EMAIL PROTECTED])
> 08456 10 00 52 Final salary pension schemes
> 08456 10 00 01 Online services ([EMAIL PROTECTED])
> 08456 00 14 02 Protection ([EMAIL PROTECTED])
>
> **************************************************************
> Scottish Equitable plc
> Registered Office: Edinburgh Park, Edinburgh EH12 9SE.
> Registered in Scotland (No. 144517).
> Authorised and Regulated by the Financial Services Authority.
> Telephone: 0870 242 6789
> **************************************************************
>
> ______________________________________________________________________
>
>
> EMAIL DISCLAIMER
>
> This message is for the intended recipient only. It may contain
> confidential or proprietary information. If you receive this message in
> error, please immediately delete it, destroy all copies of it and notify
> the sender.
> You must not use or disclose any part of this message if you are not the
> intended recipient. We may monitor all Email communication through our
> networks.
>
> If you contact us by Email, we may store your name and address to
> facilitate communication.
>
> Any views expressed in this message are those of the individual sender,
> except where the message states otherwise.
>
> We take reasonable precautions to ensure our Emails are virus free.
> However, we cannot accept responsibility for any virus transmitted by us
> and recommend that you subject any incoming Email to your own virus
> checking procedures.
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> struts-menu-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
struts-menu-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/struts-menu-user