Well the problem here was that if you do a lookup for
getClass().getResourceAsStream() it will look for a resource with the
package name of the class prefixed to the resource name. Which in the Axis
case meant that the file had to be in org/apache/axis/client or
org/apache/axis/server. If you do
getClass().getClassLoader().getResourceAsStream() a lookup is done using
the resource name only, and it can thus reside in any package. This allows
you to easily override the default Axis config without messing with the
axis.jar.
It is basically another hook to override the config similar to the one
that was already there which looked for the resource in the current
directory, before trying the classpath. The problem with the current
directory search is that it does not work in WebStart.

/Thomas


On Tue, 21 May 2002, Richard Sitze wrote:

> The engine isn't on the classpath?
> 
> 
> *******************************************
> Richard A. Sitze            [EMAIL PROTECTED]
> CORBA Interoperability & WebServices
> IBM WebSphere Development
> 
> 
>                                                                                      
>                               
>                       [EMAIL PROTECTED]                                                
>                               
>                                                To:      [EMAIL PROTECTED]      
>                               
>                       05/21/2002 09:50         cc:                                   
>                               
>                       AM                       Subject: cvs commit: 
>xml-axis/java/src/org/apache/axis/configuration 
>                       Please respond           FileProvider.java                     
>                               
>                       to axis-dev                                                    
>                               
>                                                                                      
>                               
>                                                                                      
>                               
> 
> 
> 
> 
> glyn        02/05/21 07:50:50
> 
>   Modified:    java/src/org/apache/axis/configuration FileProvider.java
>   Log:
>   Merge in patch provided by Thomas Sandholm to allow a configuration
>   file to be placed in the classpath outside of the Axis engine package.
> 
>   Revision  Changes    Path
>   1.27      +8 -2
> xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
> 
>   Index: FileProvider.java
>   ===================================================================
>   RCS file:
> /home/cvs/xml-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
> 
>   retrieving revision 1.26
>   retrieving revision 1.27
>   diff -u -r1.26 -r1.27
>   --- FileProvider.java        29 Mar 2002 00:01:26 -0000          1.26
>   +++ FileProvider.java        21 May 2002 14:50:50 -0000          1.27
>   @@ -195,8 +195,14 @@
>                        myInputStream = new FileInputStream(configFile);
>                    } catch (Exception e) {
>                        if (searchClasspath) {
>   -                        myInputStream = engine.getClass().
>   -                            getResourceAsStream(filename);
>   +                        // look for custom configuration files outside
> of engine package
>   +                        myInputStream = engine.getClass().getClassLoader
> ().
>   +                                getResourceAsStream(filename);
>   +                        if (myInputStream == null) {
>   +                            // if not found in classpath fall back to
> default config file in engine package
>   +                            myInputStream = engine.getClass().
>   +                                getResourceAsStream(filename);
>   +                        }
>                        }
>                    }
>                }
> 
> 
> 
> 
> 
> 
> 

Reply via email to