You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by na...@apache.org on 2002/05/07 17:01:23 UTC

cvs commit: xml-soap/java/webapps/soap/admin deploy.jsp list.jsp showdetails.jsp undeploy.jsp

nagy        02/05/07 08:01:23

  Modified:    java/docs/guide config.html
               java/src/org/apache/soap/server/http
                        MessageRouterServlet.java RPCRouterServlet.java
               java/webapps/soap/admin deploy.jsp list.jsp showdetails.jsp
                        undeploy.jsp
  Log:
  Added support for setting the configuration file name as a Web application context parameter so that it will be picked up by the JSPs as well as the router servlets.  This will fix the problem of the JSPs using the default ConfigMananger when one has been specified for the router servlets.  For more info, see:
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8417
  
  Revision  Changes    Path
  1.6       +22 -7     xml-soap/java/docs/guide/config.html
  
  Index: config.html
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/docs/guide/config.html,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- config.html	29 Jun 2001 15:03:57 -0000	1.5
  +++ config.html	7 May 2002 15:01:22 -0000	1.6
  @@ -24,13 +24,28 @@
   the SOAP server.)<BR>
   </P>
   <P>For HTTP transport listeners, this option
  -can be set in the configuration file for
  -the rpcrouter servlet by adding an init-parameter
  -called <I>ConfigFile</I> to the servlet's deployment properties file.
  -A servlet deployment properties file with
  -this modification would look like the following:<BR>
  +can be set in the Web application's configuration
  +file. The option, <I>ConfigFile</I>, may be specified as either a context parameter
  +within the Web application, in which case
  +all of the servlets (and JSPs) will use the
  +value, or as a servlet initialization parameter,
  +in which case only that particular servlet
  +will see the value. If it is set in both
  +places, the servlet initialization parameter
  +value will override the value of the context
  +parameter for that particular servlet. It
  +is recommended that you set the value via
  +a context parameter; the servlet initialization
  +parameter support was maintained mostly for
  +backwards compatibility. A servlet deployment
  +properties file with this modification would
  +look like the following:<BR>
   </P>
  -<pre>      &lt;servlet&gt;
  +<pre>      &lt;context-param&gt;
  +        &lt;param-name&gt;ConfigFile&lt;/param-name&gt;
  +        &lt;param-value&gt;<B><I>config-file</I></B>&lt;/param-value&gt;
  +      &lt;/context-param&gt;
  +      &lt;servlet&gt;
           &lt;servlet-name&gt;rpcrouter&lt;/servlet-name&gt;
           &lt;display-name&gt;Apache-SOAP RPC Router&lt;/display-name&gt;
           &lt;description&gt;no description&lt;/description&gt;
  @@ -195,7 +210,7 @@
       </blockquote><p>As is noted in the section <A href="#configfile">above</A>, your configuration manager can be passed
   parameters via &lt;option&gt; elements in
   the SOAP server configuration file.
  -<P>Last updated 6/28/2001 by Bill Nagy &lt;<A href="mailto:nagy@watson.ibm.com">nagy@watson.ibm.com</A>&gt;.</P>
  +<P>Last updated 5/7/2002 by Bill Nagy &lt;<A href="mailto:nagy@watson.ibm.com">nagy@watson.ibm.com</A>&gt;.</P>
   </body>
   
   
  
  
  
  1.32      +18 -1     xml-soap/java/src/org/apache/soap/server/http/MessageRouterServlet.java
  
  Index: MessageRouterServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/server/http/MessageRouterServlet.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- MessageRouterServlet.java	6 May 2002 14:42:14 -0000	1.31
  +++ MessageRouterServlet.java	7 May 2002 15:01:22 -0000	1.32
  @@ -77,14 +77,28 @@
    *
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    * @author Matthew J. Duftler (duftler@us.ibm.com)
  + * @author Bill Nagy (nagy@watson.ibm.com)
    */
   public class MessageRouterServlet extends HttpServlet {
     /*
       EnvelopeEditorFactory, XMLParser, and ConfigFile are
       all server-side parameters which can be set using Servlet
  -    init-parameters. For example, you may add the following
  +    init-parameters or WebApp context-parameters.
  +    For example, you may add the following
       description to web.xml when using Tomcat:
   
  +    <context-param>    
  +        <param-name>EnvelopeEditorFactory</param-name>
  +        <param-value>MyEnvelopeEditorFactory</param-value>
  +    </context-param>    
  +    <context-param>    
  +        <param-name>XMLParser</param-name>
  +        <param-value>SampleXMLDocumentBuilderFactory</param-value>
  +    </context-param>    
  +    <context-param>    
  +        <param-name>ConfigFile</param-name>
  +        <param-value>myconfig.xml</param-value>
  +    </context-param>    
       <servlet>
         <servlet-name>MessageRouterServlet</servlet-name>
         <servlet-class>org.apache.soap.server.http.MessageRouterServlet</servlet-class>
  @@ -101,6 +115,9 @@
           <param-value>myconfig.xml</param-value>
         </init-param>
       </servlet>
  +
  +    The servlet init-parameter values will override those of the
  +    context-parameters.
     */
     private EnvelopeEditor editor = null;
     private String configFilename = null;
  
  
  
  1.36      +45 -2     xml-soap/java/src/org/apache/soap/server/http/RPCRouterServlet.java
  
  Index: RPCRouterServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/server/http/RPCRouterServlet.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- RPCRouterServlet.java	6 May 2002 14:42:14 -0000	1.35
  +++ RPCRouterServlet.java	7 May 2002 15:01:22 -0000	1.36
  @@ -84,14 +84,28 @@
    * @author Eric M. Dashofy (edashofy@ics.uci.edu)
    * @author Kevin J. Mitchell (kevin.mitchell@xmls.com)
    * @author Wouter Cloetens (wcloeten@raleigh.ibm.com)
  + * @author Bill Nagy (nagy@watson.ibm.com)
    */
   public class RPCRouterServlet extends HttpServlet {
     /*
       EnvelopeEditorFactory, XMLParser, and ConfigFile are
       all server-side parameters which can be set using Servlet
  -    init-parameters. For example, you may add the following
  +    init-parameters or WebApp context-parameters.
  +    For example, you may add the following
       description to web.xml when using Tomcat:
   
  +    <context-param>    
  +        <param-name>EnvelopeEditorFactory</param-name>
  +        <param-value>MyEnvelopeEditorFactory</param-value>
  +    </context-param>    
  +    <context-param>    
  +        <param-name>XMLParser</param-name>
  +        <param-value>SampleXMLDocumentBuilderFactory</param-value>
  +    </context-param>    
  +    <context-param>    
  +        <param-name>ConfigFile</param-name>
  +        <param-value>myconfig.xml</param-value>
  +    </context-param>    
       <servlet>
         <servlet-name>RPCRouterServlet</servlet-name>
         <servlet-class>org.apache.soap.server.http.RPCRouterServlet</servlet-class>
  @@ -108,6 +122,9 @@
           <param-value>myconfig.xml</param-value>
         </init-param>
       </servlet>
  +
  +    The servlet init-parameter values will override those of the
  +    context-parameters.
     */
     private EnvelopeEditor editor = null;
     private String configFilename = null;
  @@ -124,8 +141,15 @@
       }
       ServletConfig servletConfig = getServletConfig();
       ServletContext servletContext = servletConfig.getServletContext();
  +    /*We're going to check for init parameters in the servletContext first
  +      and then allow people to override them in the servletConfig.  This
  +      will allow for backwards compatability with the old way of setting
  +      config parameters.*/
       String envelopeEditorFactoryClassName =
         servletConfig.getInitParameter(Constants.ENVELOPE_EDITOR_FACTORY);
  +    if (envelopeEditorFactoryClassName == null)
  +      envelopeEditorFactoryClassName
  +	= servletContext.getInitParameter(Constants.ENVELOPE_EDITOR_FACTORY);
   
   
       // Is there an envelope editory factory?
  @@ -137,7 +161,21 @@
         if (factory != null) {
           try {
             Properties props = new Properties();
  -          Enumeration enum = servletConfig.getInitParameterNames();
  +	  /*First we put in the servletContext parameters, and then
  +	    overwrite them with the servletConfig parameters if 
  +	    they are present.*/
  +          Enumeration enum = servletContext.getInitParameterNames();
  +	  
  +          while (enum.hasMoreElements()) {
  +            String name = (String)enum.nextElement();
  +
  +            if (!Constants.ENVELOPE_EDITOR_FACTORY.equals(name)
  +                && !Constants.XML_PARSER.equals(name)) {
  +              props.put(name, servletContext.getInitParameter(name));
  +            }
  +          }
  +
  +          enum = servletConfig.getInitParameterNames();
   
             while (enum.hasMoreElements()) {
               String name = (String)enum.nextElement();
  @@ -163,7 +201,10 @@
         }
       }
   
  +
       String tempStr = servletConfig.getInitParameter(Constants.CONFIGFILENAME);
  +    if (tempStr == null)
  +      tempStr = servletContext.getInitParameter(Constants.CONFIGFILENAME);
   
       // Is there a user-specified config filename?
       if (tempStr != null) {
  @@ -171,6 +212,8 @@
       }
   
       tempStr = servletConfig.getInitParameter(Constants.XML_PARSER);
  +    if (tempStr == null)
  +      tempStr = servletContext.getInitParameter(Constants.XML_PARSER);
   
       // Is there a user-specified JAXP implementation?
       if (tempStr != null) {
  
  
  
  1.6       +6 -2      xml-soap/java/webapps/soap/admin/deploy.jsp
  
  Index: deploy.jsp
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/webapps/soap/admin/deploy.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- deploy.jsp	2 Feb 2001 03:30:36 -0000	1.5
  +++ deploy.jsp	7 May 2002 15:01:22 -0000	1.6
  @@ -1,11 +1,15 @@
   <%@ page import="java.io.*, java.util.*, org.w3c.dom.*" %>
  -<%@ page import="org.apache.soap.util.*, org.apache.soap.util.xml.*, org.apache.soap.server.*" %>
  +<%@ page import="org.apache.soap.Constants, org.apache.soap.util.*, org.apache.soap.util.xml.*, org.apache.soap.server.*" %>
   
   <h1>Deploy a Service</h1>
   
   <% 
  +  String configFilename = config.getInitParameter(Constants.CONFIGFILENAME);
  +  if (configFilename == null)
  +    configFilename = application.getInitParameter(Constants.CONFIGFILENAME);
  +
   ServiceManager serviceManager =
  -  org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application);
  +  org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application, configFilename);
   
   if (!request.getMethod().equals ("POST")) { 
   %>
  
  
  
  1.4       +6 -2      xml-soap/java/webapps/soap/admin/list.jsp
  
  Index: list.jsp
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/webapps/soap/admin/list.jsp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- list.jsp	2 May 2002 21:42:25 -0000	1.3
  +++ list.jsp	7 May 2002 15:01:22 -0000	1.4
  @@ -1,10 +1,14 @@
  -<%@ page import="java.util.*, org.apache.soap.server.*" %>
  +<%@ page import="java.util.*, org.apache.soap.Constants, org.apache.soap.server.*" %>
   
   <h1>Service Listing</h1>
   
   <% 
  +  String configFilename = config.getInitParameter(Constants.CONFIGFILENAME);
  +  if (configFilename == null)
  +    configFilename = application.getInitParameter(Constants.CONFIGFILENAME);
  +
     ServiceManager serviceManager =
  -    org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application);
  +    org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application, configFilename);
   
     String[] serviceNames = serviceManager.list ();
     if (serviceNames.length == 0) {
  
  
  
  1.6       +6 -2      xml-soap/java/webapps/soap/admin/showdetails.jsp
  
  Index: showdetails.jsp
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/webapps/soap/admin/showdetails.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- showdetails.jsp	14 Feb 2001 19:11:06 -0000	1.5
  +++ showdetails.jsp	7 May 2002 15:01:22 -0000	1.6
  @@ -1,10 +1,14 @@
  -<%@ page import="java.util.*, org.apache.soap.server.*, org.apache.soap.util.xml.*" %>
  +<%@ page import="java.util.*, org.apache.soap.Constants, org.apache.soap.server.*, org.apache.soap.util.xml.*" %>
   
   <h1>Deployed Service Information</h1>
   
   <% 
  +  String configFilename = config.getInitParameter(Constants.CONFIGFILENAME);
  +  if (configFilename == null)
  +    configFilename = application.getInitParameter(Constants.CONFIGFILENAME);
  +
     ServiceManager serviceManager =
  -    org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application);
  +    org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application, configFilename);
   
     String id = request.getParameter ("id");
     DeploymentDescriptor dd = (id != null) 
  
  
  
  1.3       +5 -1      xml-soap/java/webapps/soap/admin/undeploy.jsp
  
  Index: undeploy.jsp
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/webapps/soap/admin/undeploy.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- undeploy.jsp	2 Feb 2001 03:30:36 -0000	1.2
  +++ undeploy.jsp	7 May 2002 15:01:22 -0000	1.3
  @@ -4,8 +4,12 @@
   <h1>Un-Deploy a Service</h1>
   
   <% 
  +  String configFilename = config.getInitParameter(Constants.CONFIGFILENAME);
  +  if (configFilename == null)
  +    configFilename = application.getInitParameter(Constants.CONFIGFILENAME);
  +
   ServiceManager serviceManager =
  -  org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application);
  +  org.apache.soap.server.http.ServerHTTPUtils.getServiceManagerFromContext(application, configFilename);
   
   String id = request.getParameter ("id");
   if (id == null) {