You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Glen Daniels <gd...@macromedia.com> on 2002/05/22 19:30:51 UTC

RE: cvs commit: xml-axis/java/src/org/apache/axis/configuration F ileProvider.java

This won't find it in *any* package, it'll find it (I assume) on the various classpath roots at the top (no package), right?

--Glen

> -----Original Message-----
> From: Thomas Sandholm [mailto:sandholm@mcs.anl.gov]
> Sent: Tuesday, May 21, 2002 11:51 AM
> To: axis-dev@xml.apache.org
> Subject: Re: cvs commit: 
> xml-axis/java/src/org/apache/axis/configuration
> FileProvider.java
> 
> 
> 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            rsitze@us.ibm.com
> > CORBA Interoperability & WebServices
> > IBM WebSphere Development
> > 
> > 
> >                                                             
>                                                         
> >                       glyn@apache.org                       
>                                                         
> >                                                To:      
> xml-axis-cvs@apache.org                                     
> >                       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/File
> Provider.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);
> >   +                        }
> >                        }
> >                    }
> >                }
> > 
> > 
> > 
> > 
> > 
> > 
> > 
>