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 VA...@LILLY.COM on 2002/09/06 18:02:45 UTC
Handling of server config from EngineConfigurationFactoryServlet
Hi all,
I'm pretty new to this project, but I have run accross a problem where the
default server-config.wsdd is not handled as would be expected (at least
by a newbie like me!). Using the AdminClient, updates never occur,
because FileProvider is called with it's InputStream constructor instead
of a filename based constructor. (Maybe this is on purpose for security
reasons? Then why do we care about the remote administration option?)
I've patched up EngineConfigurationFactoryServlet so that getServerEngineConfig(ServletContext ctx) seems to be behave a bit more
nicely. I've attached a patch to the latest CVS sources, I'd appreciate
some feedback as to whether or not I'm way off track with this!
Thanks,
Jason
The patch:
Index: EngineConfigurationFactoryServlet.java
===================================================================
RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java,v
retrieving revision 1.7
diff -c -r1.7 EngineConfigurationFactoryServlet.java
*** EngineConfigurationFactoryServlet.java 30 Aug 2002 19:13:05 -0000
1.7
--- EngineConfigurationFactoryServlet.java 6 Sep 2002 16:00:49 -0000
***************
*** 55,63 ****
--- 55,67 ----
package org.apache.axis.configuration;
+ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+ import java.net.MalformedURLException;
+ import java.net.URL;
+
import javax.servlet.ServletContext;
import org.apache.axis.EngineConfiguration;
***************
*** 146,167 ****
* snooped by a browser)
*/
String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
! InputStream is = ctx.getResourceAsStream(name);
! FileProvider config;
! if (is == null) {
String rootPath = ctx.getRealPath("/");
if (rootPath != null) {
name = rootPath + name;
}
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
name));
- config = null;
- } else {
- // FileProvider assumes responsibility for 'is'.
- config = new FileProvider(is);
}
! return config;
}
}
--- 150,179 ----
* snooped by a browser)
*/
String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
! URL configUrl = null;
! try {
! configUrl = ctx.getResource(name);
! } catch (MalformedURLException e) { }
!
! FileProvider config = null;
! if (configUrl != null) {
! config = new
FileProvider(configUrl.getFile().toString());
! } else {
String rootPath = ctx.getRealPath("/");
if (rootPath != null) {
name = rootPath + name;
+ File f = new File(name);
+ if (f.exists()) {
+ config = new
FileProvider(f.toString());
+ }
}
!
! if (config == null) //if it's still null now
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
name));
}
! return config;
}
}
Re: Handling of server config from EngineConfigurationFactoryServlet
Posted by Richard Sitze <rs...@us.ibm.com>.
OK, let me know if I *HAVEN'T* fixed your problem.
<ras>
*******************************************
Richard A. Sitze
Richard Sitze/Austin/IBM@IBMUS
09/09/2002 02:59 PM
Please respond to axis-dev
To: axis-dev@xml.apache.org
cc:
Subject: Re: Handling of server config from
EngineConfigurationFactoryServlet
OK. Fundamental problem (from my perspective). For a 'predeployed'
service, I may not WANT the default behavior to dynamically save the
services (no admin). The proper wsdd should already be there.
While I changed this behavior recently (bad bad me)... You DO have a
valid point. So, there is a potential for TWO different behaviours. Sound
like another candidate for a separate jar file:
1. Specifies META-INF/services/org.apache.axis.EngineConfigurationFactory
file
2. File (1) containing one line that names the class implementing the
behaviour you desire.
3. Drop it in your classpath.
However, for the sake of consistent/expected behavior for the 1.0 release,
I'm adding the behaviour back as-it-was.
<ras>
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
VASQUEZ_JASON@LILLY.COM
09/06/2002 11:02 AM
Please respond to axis-dev
To: axis-dev@xml.apache.org
cc:
Subject: Handling of server config from
EngineConfigurationFactoryServlet
Hi all,
I'm pretty new to this project, but I have run accross a problem where the
default server-config.wsdd is not handled as would be expected (at least
by a newbie like me!). Using the AdminClient, updates never occur,
because FileProvider is called with it's InputStream constructor instead
of a filename based constructor. (Maybe this is on purpose for security
reasons? Then why do we care about the remote administration option?)
I've patched up EngineConfigurationFactoryServlet so that
getServerEngineConfig(ServletContext ctx) seems to be behave a bit more
nicely. I've attached a patch to the latest CVS sources, I'd appreciate
some feedback as to whether or not I'm way off track with this!
Thanks,
Jason
The patch:
Index: EngineConfigurationFactoryServlet.java
===================================================================
RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java,v
retrieving revision 1.7
diff -c -r1.7 EngineConfigurationFactoryServlet.java
*** EngineConfigurationFactoryServlet.java 30 Aug 2002 19:13:05 -0000
1.7
--- EngineConfigurationFactoryServlet.java 6 Sep 2002 16:00:49 -0000
***************
*** 55,63 ****
--- 55,67 ----
package org.apache.axis.configuration;
+ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+ import java.net.MalformedURLException;
+ import java.net.URL;
+
import javax.servlet.ServletContext;
import org.apache.axis.EngineConfiguration;
***************
*** 146,167 ****
* snooped by a browser)
*/
String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
! InputStream is = ctx.getResourceAsStream(name);
! FileProvider config;
! if (is == null) {
String rootPath = ctx.getRealPath("/");
if (rootPath != null) {
name = rootPath + name;
}
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
name));
- config = null;
- } else {
- // FileProvider assumes responsibility for 'is'.
- config = new FileProvider(is);
}
! return config;
}
}
--- 150,179 ----
* snooped by a browser)
*/
String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
! URL configUrl = null;
! try {
! configUrl = ctx.getResource(name);
! } catch (MalformedURLException e) { }
!
! FileProvider config = null;
! if (configUrl != null) {
! config = new
FileProvider(configUrl.getFile().toString());
! } else {
String rootPath = ctx.getRealPath("/");
if (rootPath != null) {
name = rootPath + name;
+ File f = new File(name);
+ if (f.exists()) {
+ config = new
FileProvider(f.toString());
+ }
}
!
! if (config == null) //if it's still null now
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
name));
}
! return config;
}
}
Re: Handling of server config from EngineConfigurationFactoryServlet
Posted by Richard Sitze <rs...@us.ibm.com>.
OK. Fundamental problem (from my perspective). For a 'predeployed'
service, I may not WANT the default behavior to dynamically save the
services (no admin). The proper wsdd should already be there.
While I changed this behavior recently (bad bad me)... You DO have a
valid point. So, there is a potential for TWO different behaviours. Sound
like another candidate for a separate jar file:
1. Specifies META-INF/services/org.apache.axis.EngineConfigurationFactory
file
2. File (1) containing one line that names the class implementing the
behaviour you desire.
3. Drop it in your classpath.
However, for the sake of consistent/expected behavior for the 1.0 release,
I'm adding the behaviour back as-it-was.
<ras>
*******************************************
Richard A. Sitze
IBM WebSphere WebServices Development
VASQUEZ_JASON@LILLY.COM
09/06/2002 11:02 AM
Please respond to axis-dev
To: axis-dev@xml.apache.org
cc:
Subject: Handling of server config from
EngineConfigurationFactoryServlet
Hi all,
I'm pretty new to this project, but I have run accross a problem where the
default server-config.wsdd is not handled as would be expected (at least
by a newbie like me!). Using the AdminClient, updates never occur,
because FileProvider is called with it's InputStream constructor instead
of a filename based constructor. (Maybe this is on purpose for security
reasons? Then why do we care about the remote administration option?)
I've patched up EngineConfigurationFactoryServlet so that
getServerEngineConfig(ServletContext ctx) seems to be behave a bit more
nicely. I've attached a patch to the latest CVS sources, I'd appreciate
some feedback as to whether or not I'm way off track with this!
Thanks,
Jason
The patch:
Index: EngineConfigurationFactoryServlet.java
===================================================================
RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryServlet.java,v
retrieving revision 1.7
diff -c -r1.7 EngineConfigurationFactoryServlet.java
*** EngineConfigurationFactoryServlet.java 30 Aug 2002 19:13:05 -0000
1.7
--- EngineConfigurationFactoryServlet.java 6 Sep 2002 16:00:49 -0000
***************
*** 55,63 ****
--- 55,67 ----
package org.apache.axis.configuration;
+ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+ import java.net.MalformedURLException;
+ import java.net.URL;
+
import javax.servlet.ServletContext;
import org.apache.axis.EngineConfiguration;
***************
*** 146,167 ****
* snooped by a browser)
*/
String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
! InputStream is = ctx.getResourceAsStream(name);
! FileProvider config;
! if (is == null) {
String rootPath = ctx.getRealPath("/");
if (rootPath != null) {
name = rootPath + name;
}
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
name));
- config = null;
- } else {
- // FileProvider assumes responsibility for 'is'.
- config = new FileProvider(is);
}
! return config;
}
}
--- 150,179 ----
* snooped by a browser)
*/
String name = "/WEB-INF/"+ SERVER_CONFIG_FILE;
! URL configUrl = null;
! try {
! configUrl = ctx.getResource(name);
! } catch (MalformedURLException e) { }
!
! FileProvider config = null;
! if (configUrl != null) {
! config = new
FileProvider(configUrl.getFile().toString());
! } else {
String rootPath = ctx.getRealPath("/");
if (rootPath != null) {
name = rootPath + name;
+ File f = new File(name);
+ if (f.exists()) {
+ config = new
FileProvider(f.toString());
+ }
}
!
! if (config == null) //if it's still null now
! log.error(JavaUtils.getMessage("servletEngineWebInfError01",
name));
}
! return config;
}
}