RE: View Loading and Caching
"Andy Zeneski" <[email protected]> Thu, 27 Feb 2003 14:07:12 -0500
| Newsgroups | gmane.comp.java.jpublish.devel |
|---|---|
| Message-ID | <[email protected]> |
I think once this stuff is setup it really won't change very often. So,
whatever performs best. If I was to use actions for this I would write it in
Java to avoid the scripting language overhead, since it will be called for
every page.
It would be nice to have a dynamic way to add stuff to the context. However
does Velocity and WebMacro support the ability to add custom tags/objects of
such? If not, then this really only effects Freemarker. The JPublishContext
takes care of 99% of everything needed in a page, its just these custom
object which cause the pain.
For example we designed a FM Transform which is used like
<@ofbizUrl>/some/url</@ofbizUrl> which goes into our request processing
system checks if the URL needs to be called via HTTPS, gets the HTTPS
hostname, encodes the session in the URL if no cookies are available, etc.
This tag is used just about everywhere and is real nice to have.
In order to use this in the page it must be added to the root.
root.put("ofbizUrl", new OfbizUrlTransform());
So, unless this is a common problem for with other template engines I
wouldn't worry too much about it. I have written a renderer which extends
your overriding that one method. Works like a charm.
-Andy
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> Anthony Eden
> Sent: Thursday, February 27, 2003 1:51 PM
> To: jpublish-developer
> Subject: Re: [JPublish-developer] View Loading and Caching
>
>
> I see what you are saying about potential problems if the same
> renderer is not used throughout the site. I have to think about
> the idea of attaching actions to view renderers. Do you think it
> would be better just to do the work you are speaking of in your
> custom renderer as you had originally planned, or do you think it
> is necessary to find a more generic solution which can be used
> for any renderer?
>
> On a side note, is this "problem" a result of FreeMarker's
> design? Would the same type of thing be useful in the case of
> Velocity, WebMacro or other view renderers?
>
> Sincerely,
> Anthony Eden
>
> Andy Zeneski wrote:
> > Anthony,
> >
> > I looked at this again, and I see now what you are talking
> about. At first I
> > thought that the JPublishViewContext contained the
> JPublishContext, rather
> > then wrapped it. My fault for only skimming and not really reading.
> >
> > So, thinking about an action which ran to prepare the added
> attributes it
> > started sounding nice. However, this really would only work if
> all pages are
> > using the same view renderer, unless there were global actions
> which were
> > mapped to the renderer which was used.
> >
> > -Andy
> >
> >
> >
> >>The thing is that by putting something in the JPublishContext it
> >>*IS* the root context. The FreeMarkerViewContext just wraps the
> >>JPublishContext. Unless I am missing something I still think
> >>that putting values in the JPublishContext would still meet your
> >>needs. I may be missing something though because I am not
> >>intimately familiar with all of the details of FreeMarker.
> >>
> >>On a side note, one of the reasons for using actions as opposed
> >>to extending the system directly is because of the flexibility it
> >>provides. Performance-wise I don't think it will be much
> >>different then putting code in your custom renderer.
> >>
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Jpublish-developer mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jpublish-developer
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Jpublish-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jpublish-developer
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf