Re: Re: [Webmacro-devel] WM-constructor

Marc Palmer <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Organization AnyWare Ltd.
Message-ID <[email protected]>
Keats Kirsch wrote:
> It needs the servletContext *and* the classloader for the 
> servletContext.  WM can get both from the Servlet, which is why it was 
> done that way.  I don't think there is a guaranteed way to get the 
> servlet classloader from the servletContext.
> 
> Let's not break all the old WM servlet code.  However if you want to be 
> explicitly pass in both arguments, I don't see any problem with that.

Precisely what I was talking of doing. Breaking stuff is not going to 
happen :)

However I am interested in any ideas for getting a reference to the web 
application's own ClassLoader from within a class that has no reference 
to the Serlvet, only the ServletContext.

I suppose in theory you could use the (most/all deprecated) methods on 
ServletContext to iterate over the servlets and just grab any one and 
call getClass().getClassLoader() on it.

Doesn't feel good though...
-- 
Marc Palmer    [email protected]
			
Wangjammers - Java, J2ME and Web Consultants
   ~ http://www.wangjammers.org/



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
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.