Velocity Tools
  1. Velocity Tools
  2. VELTOOLS-106

VelocityViewTag needs caching using the not yet released StringResourceLoader

    Details

    • Type: Wish Wish
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: VelocityView
    • Labels:
      None
    • Environment:
      resin3.0 jdk1.5

      Description

      Dear developers,

      Sorry to bother you!

      I am a user of VelocityTools from China, and I want to rewrite some JSP pages in Velocity template language. I have no idea whether to use VelocityViewServlet or VelocityViewTag, then I choosed VelocityViewTag, considering some JSP features, such as taglib or fragment, may be used.

      I use resin as J2EE container, when I use VelocityViewTag in the page, I found the page displayed so slowly in web browser. Maybe the compilation of Velocity template requires much time, I think. So, can you give me some advice on how to improve the speed?

      Thank you very much and expect your early reply!

        Activity

        Hide
        Nathan Bubna added a comment -

        So, i realized today that we could provide some simple, default setting caching for VelocityViewTag bodyContent, because the default static repo settings for StringResourceLoader are essentially the same on the surface in both Engine 1.5 and Engine 1.6.

        So, yeah, as of revision 709355, the VelocityViewTag now caches tag bodies by default, rather than re-parsing them for every render.

        I have no idea why it didn't occur to me to do this before. I was probably just imagining the impossibility of supporting all the possibilities of 1.6's StringResourceLoader while only requiring 1.5 for Tools 2.0. Sorry 'bout that.

        Show
        Nathan Bubna added a comment - So, i realized today that we could provide some simple, default setting caching for VelocityViewTag bodyContent, because the default static repo settings for StringResourceLoader are essentially the same on the surface in both Engine 1.5 and Engine 1.6. So, yeah, as of revision 709355, the VelocityViewTag now caches tag bodies by default, rather than re-parsing them for every render. I have no idea why it didn't occur to me to do this before. I was probably just imagining the impossibility of supporting all the possibilities of 1.6's StringResourceLoader while only requiring 1.5 for Tools 2.0. Sorry 'bout that.
        Hide
        Claude Brisson added a comment -

        Hi bulejoe,

        Nathan did already answer your question on the user mailing list, didn't you see it?

        I paste again his answer:

        > yes, the VelocityViewTag does not currently do any caching of the
        > template/tag body, so it must be reparsed for each render. Once
        > Velocity Engine 1.6 is released, we will be able to properly use the
        > new StringResourceLoader to easily provide that caching. until that
        > time, VelocityViewTag will only perform well when it loads templates
        > via a template="foo.vm" attribute, rather than having the template as
        > its body.

        Maybe it wasn't clear enough for you, then you should continue on the user mailing list,
        this place is not meant to discuss user issues.

        Still, we can maybe leave this ticket open to remember to implement this caching once
        the v1.6 of the engine is out...

        Claude

        Show
        Claude Brisson added a comment - Hi bulejoe, Nathan did already answer your question on the user mailing list, didn't you see it? I paste again his answer: > yes, the VelocityViewTag does not currently do any caching of the > template/tag body, so it must be reparsed for each render. Once > Velocity Engine 1.6 is released, we will be able to properly use the > new StringResourceLoader to easily provide that caching. until that > time, VelocityViewTag will only perform well when it loads templates > via a template="foo.vm" attribute, rather than having the template as > its body. Maybe it wasn't clear enough for you, then you should continue on the user mailing list, this place is not meant to discuss user issues. Still, we can maybe leave this ticket open to remember to implement this caching once the v1.6 of the engine is out... Claude

          People

          • Assignee:
            Unassigned
            Reporter:
            bluejoe
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development