Re: Accessing templates in jars
Keats Kirsch <[email protected]>
| Newsgroups | gmane.comp.java.webmacro.user |
|---|---|
| Message-ID | <[email protected]> |
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/