Re: Accessing templates in jars

Lane Sharman <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
I could incorporate this into WMEval.java as a new constructor:

WMEval(Object env) {
     if (env instanceof HttpServlet) wm = new WM(this);
     else wm = new WM();
}

Tim: perhaps you could take a look at WMEval as that this may provide 
some guidelines. WMEval is a wrapper which encapsulates both Servlet and 
non-Servlet environments.

-Lane

Keats Kirsch wrote:

> The Servlet container knows how to load things from the Servlet class 
> path, but POJOs don't know anything about this.  The Servlet22Broker 
> basically delegates the search to the container.
> Since WM can run outside of Servlet containers, we use a trick of 
> passing in the Servlet instance in the constructor to get determine 
> that it is in "Servlet-mode" and to get access to the ServletContext.  
> You could do something similar, like:
>
>  if (this instanceof HttpServlet) wm = new WM(this);
>  else wm = new WM();
>
> Hope this helps.
>
> Keats
>
> Tim Pizey wrote:
>
>> Hi Keats,
>> Thanks for your patience,
>> On Tuesday 23 November 2004 18:47, Keats Kirsch wrote:
>>  
>>
>>> I guess you can see the issue here.  You want to use Servlet-specific
>>> functionality without introducing Servlet-specific code.  I suppose you
>>> could create a new version of WM that allows you to set the broker
>>> outside of the constructor, but at some point you'll have to provide a
>>> reference to the context so that the broker knows where to look.
>>>   
>>
>>
>> The default behaviour currently appears to be to look for templates 
>> in a sub-set of the classpath ?
>>
>> I only have a naive view of how the servlet container classpath works 
>> but I got the impression it was something like
>> CLASSPATH = WEB-INF/classes; WEB-INF/lib/*.jar ; endorsed/*.jar ; 
>> inheritted classpath
>> Is the above not available as a list of places to look, perhaps even 
>> in a handy CLASSPATH environment variable, without having to invoke a 
>> servlet specific broker?
>>
>> I guess what I don't understand is if a class can be found both in 
>> WEB-INF/classes and WEB-INF/lib/*.jar why can't a template?
>>
>> So I guess I can't see why this is servlet specific functionality?
>>
>> thanks again
>>
>> tim
>>
>>
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real users.
>> Discover which products truly live up to the hype. Start reading now. 
>> http://productguide.itmanagersjournal.com/
>> _______________________________________________
>> Webmacro-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>>
>>  
>>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Webmacro-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>

-- 
Lane Sharman
Providing Private and SPAM-Free Email
http://www.opendoors.com
858-755-2868



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.