Getting local path of app from EJB

R

Ranjit

Hi,

I am trying to get local disk path of my webapp (at run time) that has
an EJB deployed in it. The EJB is a simple remote EJB annotated with the
@Remote annotation.

For a servlet we can get it by calling the
servletContext.getAbsolutePath(), but I was not able to find a way out
to do the same within an EJB since there is no handle to the
ServletContext/ServletConfig objects.
invoking getClass().ClassLoader.getResource() on a valid bundled file
didn't help either!

I have overridden the setSessionContext() method, but I don't think I
can pullout the absolute path starting from the SessionContext object.

Any suggestion for me?

TIA,
Ranjit
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Ranjit said:
I am trying to get local disk path of my webapp (at run time) that has
an EJB deployed in it. The EJB is a simple remote EJB annotated with the
@Remote annotation.

For a servlet we can get it by calling the
servletContext.getAbsolutePath(), but I was not able to find a way out
to do the same within an EJB since there is no handle to the
ServletContext/ServletConfig objects.
invoking getClass().ClassLoader.getResource() on a valid bundled file
didn't help either!

I have overridden the setSessionContext() method, but I don't think I
can pullout the absolute path starting from the SessionContext object.

Considering that the EJB spec says:

An enterprise bean must not use the java.io package to attempt to
access files and directories in the file system.

then there are not much need for the feature.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top