Re: View Loading and Caching

Anthony Eden <[email protected]> Thu, 27 Feb 2003 10:32:22 -0500
Newsgroups gmane.comp.java.jpublish.devel
Message-ID <[email protected]>
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.

Regardless, the method is there so use it if you would like.

Sincerely,
Anthony Eden

Andy Zeneski wrote:
> Well, first thanks for putting in the patch, now I can commit my stuff to
> OFBiz. The main issue is Freemarker Transforms and custom methods, which
> need to be on every page. Yes, one way that I didn't think of would be to
> place these in a global action. But that would be one more action to run
> each page. Actually, I believe the transforms (user-defined functions/tags)
> *NEED* to be in the root context, which would be the FreeMarkerViewContext,
> so an action may not work and a customized FreeMarkerViewContext would be
> necessary.
> 
> -Andy
> 
> 
>>-----Original Message-----
>>From: [email protected]
>>[mailto:[email protected]]On Behalf Of
>>Anthony Eden
>>Sent: Thursday, February 27, 2003 9:23 AM
>>To: jpublish-developer
>>Subject: Re: [JPublish-developer] View Loading and Caching
>>
>>
>>I have committed your patch, but I want to say that it still
>>bothers me.  The problem is that you will need to provide a new
>>implementation of the FreeMarkerViewContext because that class
>>only provides a wrapped version of the JPublishContext.  In most
>>cases you will probably want to just put values directly in the
>>JPublish context via an action.  That is unless I am missing a
>>compelling reason why you must populate the FreeMarker context directly?
>>
>>Sincerely,
>>Anthony Eden
>>
>>Andy Zeneski wrote:
>>
>>>>What is the point of passing the path to the createTemplateContext()
>>>>method?  Also, can you explain to me why you would want to override this
>>>>method?  I.e. why would you want to create a different instance of the
>>>>root context when it is just a wrapper around the JPublishContext?
>>>>
>>>
>>>
>>>I put the path there, just in case someone came up with a
>>
>>reason to use it
>>
>>>and because it was available.
>>>
>>>The main reason for overriding this method is because other objects in
>>>addition to the JPublishContext may (and in our case do) need
>>
>>to be in the
>>
>>>root context for the template. We have some custom transforms
>>
>>and freemarker
>>
>>>methods which need to be in the root. Also, we utilize some of
>>
>>the wrappers
>>
>>>for request parameters, etc.
>>>
>>>I thought this would make it more flexible for customization
>>
>>and allow to
>>
>>>reuse as much existing code as possible.
>>>
>>>-Andy
>>>
>>
>>
>>
>>-------------------------------------------------------
>>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