Hi, devs:

I implemented a axis2 service and deployed it to tomcat. My tomcat webapps is configured as /var/www/webapps. So the axis context has this file structure:

/var/www/webapps/axis2/axis2-web
/var/www/webapps/axis2/META-INF
/var/www/webapps/axis2/WEB-INF

In my service implementation, it has code to generate a new directory /var/www/webapps/axis2/mydata and use it to write, read and delete files.

In order to archive this purpose, I set an environment variable AXSI_HOME= /var/www/webapps/ which let the implementation code aware where the service was deployed. It works fine. But this introduce a extra step in installation, set up an environment variable.

Now I have got a new task to create a installer for this web service. Ideally I want to create a war file and the installation just needs a user dropping the war file into the tomcat webapps directory. There are no any environment variable setting or script running.

In order to do this, I want to the implementation code itself can detect where it was deployed.

I added the following code in my implemenation:

 MessageContext messageContext = MessageContext.getCurrentMessageContext();
      if(messageContext != null) {
ConfigurationContext configurationContext = messageContext.getConfigurationContext();
        if(configurationContext != null){
System.out.println("context root "+configurationContext.getContextRoot()); System.out.println("servcie context path "+configurationContext.getServiceContextPath()); System.out.println("servcie path "+configurationContext.getServicePath());
        }
      }

The output is:
context root /axis2
servcie context path /axis2/services
servcie path services

Those are NOT what I want. I want something which can get /var/www/webapps/axis2. Do you have any idea? Any suggestion and comment will be highly appreciated.


Regards,

Jing



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to