myBean.getClass().getResourceAsStream( "xyz" )
or
MyBean.class.getResourceAsStream( "xyz" )
(one for instance, one for class type) both go through the ClassLoader.
The ClassLoader looks up a file called "xyz" in the same path it obtains
MyBean from and uses the exact same mechanism for getting the bytecode
as it does for "xyz".
Although what you get back is an InputStream produces from a URL, you do
not need a java.io.FilePermission to get such a file, since the
ClassLoader already (granted) has permission to read the contents of
your EJB JAR.
Therefore, you can use getResourceAsStream() to obtain input streams
into files packages with your EJB JAR (and also those in library JARs),
although you cannot open input streams to other files from within an EJB
container.
arkin
dan benanav wrote:
>
> Can someone explain how the classloader is related to all this with some concrete
> examples?
>
> Thanks,
> dan
>
> Assaf Arkin wrote:
--
----------------------------------------------------------------------
Assaf Arkin www.exoffice.com
CTO, Exoffice Technologies, Inc. www.exolab.org
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".