axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ingrid Falk <ingrid.f...@loria.fr>
Subject WEB-INF path when axis is used from within a jar
Date Mon, 10 Feb 2003 09:17:16 GMT

Hi,

i integrated axis into my own web-application which is packed in a
war and served by the tomcat 4.x servlet-container. The
AxisServletBase provides the methods getWebInfPath getHomeDir which
use ServletContext.getRealPath("/WEB-INF") (for eg.) to set them at
init time. But from within
a jar, getRealPath returns null. The webInfPath and homeDir are later
propagated to the MessageContext via the MC_CONFIGPATH and MC_HOME_DIR
properties. So i get null when i try to access resources in my webapp
under the WEB-INF directory. 

For now i changed AxisServletBase to also use
ServletContext.getResource(resourcePath) when getRealPath returned null:

In AxisServletBase:

    public void init() {
        ServletContext context = getServletConfig().getServletContext();

        webInfPath = context.getRealPath("/WEB-INF");
        // when the webapp is in a war we get null as webInfPath:
        if (webInfPath==null) {
          try {
            URL webInfURL = context.getResource("/WEB-INF");
            webInfPath = webInfURL.toString();
          } catch (MalformedURLException u) {
          // sorry, still couldn't get a decent path ...
          }
        }

       //......
    }

But as i'd rather not make changes to AxisServletBase, is there
another way i could get access to my resources in the WEB-INF, without
touching the axis-code?

Regards,

Ingrid


Mime
View raw message