dims 02/02/14 09:12:01
Modified: java build.xml
java/src/org/apache/axis EngineConfigurationFactory.java
java/src/org/apache/axis/configuration
DefaultEngineConfigurationFactory.java
java/src/org/apache/axis/transport/http AdminServlet.java
AxisServlet.java
Added: java/src/org/apache/axis/configuration
ServletEngineConfigurationFactory.java
Log:
Factor out ServletContext from EngineConfigurationFactory by
- Deleting getServerEngineConfig(ServletContext ctx) method from
EngineConfigurationFactory
- Adding a new ServletEngineConfigurationFactory.java
- Changing references in AdminServlet and AxisServlet to use the new
ServletEngineConfigurationFactory.
Revision Changes Path
1.105 +1 -0 xml-axis/java/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/build.xml,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- build.xml 14 Feb 2002 16:41:34 -0000 1.104
+++ build.xml 14 Feb 2002 17:12:01 -0000 1.105
@@ -210,6 +210,7 @@
<exclude name="**/org/apache/axis/attachments/ManagedMemoryDataSource.java"
unless="attachments.present"/>
<exclude
name="**/org/apache/axis/attachments/MultiPartRelatedInputStream.java"
unless="attachments.present"/>
<exclude name="**/org/apache/axis/attachments/BoundaryDelimitedStream.java"
unless="attachments.present"/>
+ <exclude
name="**/org/apache/axis/configuration/ServletEngineConfigurationFactory.java"
unless="servlet.present"/>
<exclude name="**/org/apache/axis/encoding/ser/JAFDataHandlerSerializer.java"
unless="attachments.present"/>
<exclude
name="**/org/apache/axis/encoding/ser/JAFDataHandlerDeserializerFactory.java"
unless="attachments.present"/>
<exclude
name="**/org/apache/axis/encoding/ser/JAFDataHandlerSerializerFactory.java"
unless="attachments.present"/>
1.4 +0 -9
xml-axis/java/src/org/apache/axis/EngineConfigurationFactory.java
Index: EngineConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/EngineConfigurationFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EngineConfigurationFactory.java 7 Feb 2002 13:46:36 -0000 1.3
+++ EngineConfigurationFactory.java 14 Feb 2002 17:12:01 -0000 1.4
@@ -56,7 +56,6 @@
package org.apache.axis;
import javax.xml.rpc.namespace.QName;
-import javax.servlet.ServletContext;
/**
* EngineConfigurationFactory is an interface used to construct
@@ -84,12 +83,4 @@
* @return a server EngineConfiguration
*/
public EngineConfiguration getServerEngineConfig();
-
- /**
- * Get a default server engine configuration in a servlet environment.
- *
- * @param ctx a ServletContext
- * @return a server EngineConfiguration
- */
- public EngineConfiguration getServerEngineConfig(ServletContext ctx);
}
1.4 +3 -37
xml-axis/java/src/org/apache/axis/configuration/DefaultEngineConfigurationFactory.java
Index: DefaultEngineConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/DefaultEngineConfigurationFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultEngineConfigurationFactory.java 7 Feb 2002 13:46:36 -0000 1.3
+++ DefaultEngineConfigurationFactory.java 14 Feb 2002 17:12:01 -0000 1.4
@@ -59,8 +59,6 @@
import org.apache.axis.EngineConfiguration;
import org.apache.axis.Constants;
-import javax.servlet.ServletContext;
-
import java.io.File;
import java.io.InputStream;
@@ -78,10 +76,10 @@
* @author Glyn Normington ([EMAIL PROTECTED])
*/
public class DefaultEngineConfigurationFactory implements
EngineConfigurationFactory {
- private static final String CLIENT_CONFIG_FILE = "client-config.wsdd";
- private static final String SERVER_CONFIG_FILE = "server-config.wsdd";
+ protected static final String CLIENT_CONFIG_FILE = "client-config.wsdd";
+ protected static final String SERVER_CONFIG_FILE = "server-config.wsdd";
- private EngineConfigurationFactory userFactory = null;
+ protected EngineConfigurationFactory userFactory = null;
private String clientConfigFile;
@@ -139,38 +137,6 @@
return new FileProvider(serverConfigFile);
} else {
return userFactory.getServerEngineConfig();
- }
- }
-
- /**
- * Get a default server engine configuration in a servlet environment.
- *
- * @param ctx a ServletContext
- * @return a server EngineConfiguration
- */
- public EngineConfiguration getServerEngineConfig(ServletContext ctx) {
- if (userFactory == null) {
- /*
- * Use the WEB-INF directory (so the config files can't get
- * snooped by a browser)
- */
- String webInfPath = ctx.getRealPath("/WEB-INF");
-
- FileProvider config = null ;
-
- if (!(new File(webInfPath,
- SERVER_CONFIG_FILE)).exists()){
- InputStream is = null ;
- is = ctx.getResourceAsStream("/WEB-INF/"+
- SERVER_CONFIG_FILE);
- if (is != null) config = new FileProvider(is);
- }
- if ( config == null )
- config = new FileProvider(webInfPath,
- SERVER_CONFIG_FILE);
- return config;
- } else {
- return userFactory.getServerEngineConfig(ctx);
}
}
}
1.1
xml-axis/java/src/org/apache/axis/configuration/ServletEngineConfigurationFactory.java
Index: ServletEngineConfigurationFactory.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.configuration;
import org.apache.axis.EngineConfigurationFactory;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.Constants;
import javax.servlet.ServletContext;
import java.io.File;
import java.io.InputStream;
/**
* This is a default implementation of ServletEngineConfigurationFactory.
* It is user-overrideable by a system property without affecting
* the caller. If you decide to override it, use delegation if
* you want to inherit the behaviour of this class as using
* class extension will result in tight loops. That is, your
* class should implement EngineConfigurationFactory and keep
* an instance of this class in a member field and delegate
* methods to that instance when the default behaviour is
* required.
*
* @author Davanum Srinivas ([EMAIL PROTECTED])
*/
public class ServletEngineConfigurationFactory extends
DefaultEngineConfigurationFactory {
private ServletContext ctx;
/**
* Create the default engine configuration and detect whether the user
* has overridden this with their own.
*/
public ServletEngineConfigurationFactory(ServletContext ctx) {
super();
this.ctx = ctx;
}
/**
* Get a default server engine configuration.
*
* @return a server EngineConfiguration
*/
public EngineConfiguration getServerEngineConfig() {
return getServerEngineConfig(ctx);
}
/**
* Get a default server engine configuration in a servlet environment.
*
* @param ctx a ServletContext
* @return a server EngineConfiguration
*/
private EngineConfiguration getServerEngineConfig(ServletContext ctx) {
if (userFactory == null) {
/*
* Use the WEB-INF directory (so the config files can't get
* snooped by a browser)
*/
String webInfPath = ctx.getRealPath("/WEB-INF");
FileProvider config = null ;
if (!(new File(webInfPath,
SERVER_CONFIG_FILE)).exists()){
InputStream is = null ;
is = ctx.getResourceAsStream("/WEB-INF/"+
SERVER_CONFIG_FILE);
if (is != null) config = new FileProvider(is);
}
if ( config == null )
config = new FileProvider(webInfPath,
SERVER_CONFIG_FILE);
return config;
} else {
return userFactory.getServerEngineConfig();
}
}
}
1.13 +3 -3
xml-axis/java/src/org/apache/axis/transport/http/AdminServlet.java
Index: AdminServlet.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AdminServlet.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AdminServlet.java 7 Feb 2002 13:46:36 -0000 1.12
+++ AdminServlet.java 14 Feb 2002 17:12:01 -0000 1.13
@@ -56,7 +56,7 @@
package org.apache.axis.transport.http ;
import org.apache.axis.EngineConfiguration;
-import org.apache.axis.configuration.DefaultEngineConfigurationFactory;
+import org.apache.axis.configuration.ServletEngineConfigurationFactory;
import org.apache.axis.server.AxisServer;
import org.apache.axis.utils.JavaUtils;
@@ -81,8 +81,8 @@
ServletContext context = getServletContext();
if (context.getAttribute("AxisEngine") == null) {
EngineConfiguration config =
- (new DefaultEngineConfigurationFactory()).
- getServerEngineConfig(context);
+ (new ServletEngineConfigurationFactory(context)).
+ getServerEngineConfig();
context.setAttribute("AxisEngine", new AxisServer(config));
}
1.80 +3 -3
xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
Index: AxisServlet.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- AxisServlet.java 12 Feb 2002 22:25:25 -0000 1.79
+++ AxisServlet.java 14 Feb 2002 17:12:01 -0000 1.80
@@ -61,7 +61,7 @@
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.EngineConfiguration;
-import org.apache.axis.configuration.DefaultEngineConfigurationFactory;
+import org.apache.axis.configuration.ServletEngineConfigurationFactory;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPFaultElement;
import org.apache.axis.security.servlet.ServletSecurityProvider;
@@ -163,8 +163,8 @@
String webInfPath = context.getRealPath("/WEB-INF");
EngineConfiguration config =
- (new DefaultEngineConfigurationFactory()).
- getServerEngineConfig(context);
+ (new ServletEngineConfigurationFactory(context)).
+ getServerEngineConfig();
Map environment = new HashMap();
environment.put("servletContext", context);