igors       02/02/27 09:19:49

  Modified:    java/src/org/apache/axis/transport/http AdminServlet.java
                        AxisServlet.java
  Log:
  To start AxisEngine consistently within any servlet context,
  a static method getEngine(HttpServlet) is exposed on AxisServlet.
  This method can be used by any servlet in a web application
  to properly instantiate and share AxisServer in the context.
  It is useful, for example, when a specific classloader has
  to be configured and used when AxisServer starts.
  
  Revision  Changes    Path
  1.14      +3 -10     
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- AdminServlet.java 14 Feb 2002 17:12:01 -0000      1.13
  +++ AdminServlet.java 27 Feb 2002 17:19:48 -0000      1.14
  @@ -59,6 +59,7 @@
   import org.apache.axis.configuration.ServletEngineConfigurationFactory;
   import org.apache.axis.server.AxisServer;
   import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.AxisFault;
   
   import javax.servlet.ServletContext;
   import javax.servlet.ServletException;
  @@ -77,16 +78,8 @@
    * @author Glen Daniels ([EMAIL PROTECTED])
    */
   public class AdminServlet extends HttpServlet {
  -    public AxisServer getEngine() {
  -        ServletContext context = getServletContext();
  -        if (context.getAttribute("AxisEngine") == null) {
  -            EngineConfiguration config =
  -                (new ServletEngineConfigurationFactory(context)).
  -                getServerEngineConfig();
  -
  -            context.setAttribute("AxisEngine", new AxisServer(config));
  -        }
  -        return (AxisServer)context.getAttribute("AxisEngine");
  +    public AxisServer getEngine() throws AxisFault {
  +        return AxisServlet.getEngine(this);
       }
   
       public void doGet(HttpServletRequest req, HttpServletResponse res)
  
  
  
  1.85      +11 -6     
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.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- AxisServlet.java  22 Feb 2002 23:39:46 -0000      1.84
  +++ AxisServlet.java  27 Feb 2002 17:19:49 -0000      1.85
  @@ -80,7 +80,6 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
  -import javax.servlet.http.HttpUtils;
   import java.io.ByteArrayInputStream;
   import java.io.File;
   import java.io.IOException;
  @@ -159,10 +158,16 @@
               jwsClassDir = context.getRealPath("/");
           }
       }
  +    
  +    public AxisServer getEngine() throws AxisFault { return getEngine(this); }
   
  -    public AxisServer getEngine() throws AxisFault {
  -        ServletContext  context = getServletContext();
  -
  +    /**
  +     * This is a uniform method of initializing AxisServer in a servlet
  +     * context.
  +     */
  +    static public AxisServer getEngine(HttpServlet servlet) throws AxisFault {
  +        ServletContext context = servlet.getServletContext();
  +        
           if (context.getAttribute("AxisEngine") == null) {
               String webInfPath = context.getRealPath("/WEB-INF");
   
  @@ -172,7 +177,7 @@
   
               Map environment = new HashMap();
               environment.put("servletContext", context);
  -            String attdir= getInitParameter("axis.attachments.Directory");
  +            String attdir= servlet.getInitParameter("axis.attachments.Directory");
               if(attdir != null) environment.put("axis.attachments.Directory",  
attdir);
               if(null != webInfPath){
                   environment.put("servlet.realpath",  webInfPath + File.separator + 
"attachments");
  @@ -249,7 +254,7 @@
                                      req.getRemoteAddr());
   
               try {
  -                String url = HttpUtils.getRequestURL(req).toString();
  +                String url = req.getRequestURL().toString();
   
                   msgContext.setProperty(MessageContext.TRANS_URL, url);
   
  
  
  


Reply via email to