users@glassfish.java.net

ServletContext.getRealPath() in EJB webservice

From: <glassfish_at_javadesktop.org>
Date: Tue, 12 Feb 2008 07:41:23 PST

Hello,

I have a class implementing a webservice, in which I use the ServletContext's getRealPath() method to return the absolute path of a file I included in the .war package.

When I tried to do create an EJB from that class implementing the webservice, the ServletContext's getRealPath() method stopped working. I found out, that this is because the MessageContext doesn't contain a reference to the ServletContext in case of EJB contained webservices.

Does anyone have a suggestion about how I should be getting the absolute path of a given file if I can't use ServletContext.getRealPath()?

Thanks.

Kolos
[Message sent by forum member 'kolos' (kolos)]

http://forums.java.net/jive/thread.jspa?messageID=258514