Hi Upul,

Yes, I guess this would work, but I'd like to avoid adding a dependency to servlet-api.jar (needed for ServletContext). It looks like it's a common problem with J2EE apps, as seen in the thread "libraries and configuration files"... I think I'll just add a property in my services.xml as a workaround, to specify the absolute path where the file can be found.

Thank you very much for your response,

Etienne


Upul Godage wrote :
Hi Etienne,

You can do something like this.
In your service class you can have init(ServiceContext) method which
is called by Axis2. You can use serviceContext like this.

public class ServiceClass {

    public void init(ServiceContext serviceContext) {
       ServletContext servletContext = (ServletContext)
serviceContext.getProperty("transport.http.servletContext");
       servletContext.getResourceAsStream("/WEB-INF/path/file");
    }

...
}

Hope this helps.


Upul


On Nov 13, 2007 1:29 AM, Etienne Dube <[EMAIL PROTECTED]> wrote:
Hello,

I'm looking for a way to retrieve the local path where an Axis2 service
is deployed. In my case, it is located in
C:\java\Tomcat6\webapps\axis2\WEB-INF\services\MyService . I deployed it
as a directory instead of an .aar archive for performance reasons (I use
lots of external JARs and class loading is too slow when deploying as an
.aar). In the code of my service class, I need to open a file located in
the root of the service directory structure. For the moment I'm using a
hard-coded path, but I'd like to handle this in a more graceful manner.
Is there a way to do what I want? I'm using Axis2 version 1.3.

Thank you in advance,

Etienne


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to