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 di...@apache.org on 2006/09/04 02:58:57 UTC

svn commit: r439892 - in /webservices/axis2/trunk/java/modules: kernel/src/org/apache/axis2/ kernel/src/org/apache/axis2/context/ kernel/src/org/apache/axis2/transport/http/ kernel/src/org/apache/axis2/transport/mail/ kernel/src/org/apache/axis2/transp...

Author: dims
Date: Sun Sep  3 17:58:54 2006
New Revision: 439892

URL: http://svn.apache.org/viewvc?view=rev&rev=439892
Log:
Fix for AXIS2-1105   HardCoded Context Root in ConfigurationContext 

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java
    webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp
    webservices/axis2/trunk/java/modules/webapp/listFaultyService.jsp
    webservices/axis2/trunk/java/modules/webapp/listGroupService.jsp
    webservices/axis2/trunk/java/modules/webapp/listService.jsp
    webservices/axis2/trunk/java/modules/webapp/listServices.jsp
    webservices/axis2/trunk/java/modules/webapp/listSingleService.jsp

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Sun Sep  3 17:58:54 2006
@@ -147,6 +147,8 @@
     public static final String HTTP_SERVLET_REQUEST = "transport.http.servletRequest";
 
     public static final String SERVICE_MAP = "servicemap";
+    public static final String SERVICE_ROOT = "serviceRoot";
+    public static final String SERVICE_PATH = "servicePath";
     public static final String SERVICE_HANDLERS = "serviceHandlers";
     public static final String SERVICE_GROUP_MAP = "serviceGroupmap";
     public static final String SERVICE = "service";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java Sun Sep  3 17:58:54 2006
@@ -60,8 +60,8 @@
     private long serviceGroupContextTimoutInterval = 30 * 1000;
 
     //To specify url mapping for services
-    private String contextRoot = "/axis2";
-    private String serviceContextPath = contextRoot + "/services";
+    private String contextRoot = "axis2";
+    private String servicePath = "services";
     //To have your own context path
 
     public ConfigurationContext(AxisConfiguration axisConfiguration) {
@@ -380,22 +380,31 @@
     }
 
     public String getServiceContextPath() {
-        return serviceContextPath;
+        String path =  getContextRoot().trim() + "/";
+        if(servicePath == null || servicePath.trim().length() == 0){
+            throw new IllegalArgumentException("service path cannot be null or empty");
+        } else {
+            path += servicePath.trim();
+        }
+        return path;
     }
 
-    public void setServiceContextPath(String serviceContextPath) {
-        if (serviceContextPath == null || "".equals(serviceContextPath)) {
+    public String getServicePath() {
+        if(servicePath == null || servicePath.trim().length() == 0){
             throw new IllegalArgumentException("service path cannot be null or empty");
         }
-        if (contextRoot != null && contextRoot.trim().length() != 0 && !contextRoot.equals("/")) {
-            this.serviceContextPath = contextRoot + "/" + serviceContextPath;
-        } else {
-            this.serviceContextPath = "/" + serviceContextPath;
-        }
+        return servicePath.trim();
     }
 
     public String getContextRoot() {
-        return this.contextRoot;
+        if (contextRoot == null || contextRoot.trim().length() == 0) {
+            throw new IllegalArgumentException("context root cannot be null or empty");
+        }
+        return this.contextRoot.trim();
+    }
+
+    public void setServicePath(String servicePath) {
+        this.servicePath = servicePath;
     }
 
     public void setContextRoot(String contextRoot) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContextFactory.java Sun Sep  3 17:58:54 2006
@@ -122,7 +122,7 @@
         if (servicePath != null) {
             String spath = ((String) servicePath.getValue()).trim();
             if (spath.length() > 0) {
-                configContext.setServiceContextPath(spath);
+                configContext.setServicePath(spath);
             }
         }
     }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AbstractAgent.java Sun Sep  3 17:58:54 2006
@@ -146,4 +146,10 @@
       }
     }
   }
+
+    protected void populateSessionInformation(HttpServletRequest req) {
+        HashMap services = configContext.getAxisConfiguration().getServices();
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AdminAgent.java Sun Sep  3 17:58:54 2006
@@ -312,10 +312,7 @@
         HashMap modules = configContext.getAxisConfiguration().getModules();
 
         req.getSession().setAttribute(Constants.MODULE_MAP, modules);
-
-        HashMap services = configContext.getAxisConfiguration().getServices();
-
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
 
         String moduleName = req.getParameter("modules");
 
@@ -383,18 +380,14 @@
 
     protected void processSelectServiceParaEdit(HttpServletRequest req, HttpServletResponse res)
             throws IOException, ServletException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
         req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "SERVICE_PARAMETER");
         renderView(SELECT_SERVICE_JSP_NAME, req, res);
     }
 
     protected void processListOperation(HttpServletRequest req, HttpServletResponse res)
             throws IOException, ServletException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
         req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "MODULE");
 
         renderView(SELECT_SERVICE_JSP_NAME, req, res);
@@ -410,13 +403,8 @@
                     service.setActive(true);
                 }
             }
-            HashMap services = configContext.getAxisConfiguration().getServices();
-            req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        } else {
-            HashMap services = configContext.getAxisConfiguration().getServices();
-            req.getSession().setAttribute(Constants.SERVICE_MAP, services);
         }
-
+        populateSessionInformation(req);
         renderView(ACTIVATE_SERVICE_JSP_NAME, req, res);
     }
 
@@ -429,12 +417,10 @@
                     AxisService service = configContext.getAxisConfiguration().getService(serviceName);
                     service.setActive(false);
                 }
-                HashMap services = configContext.getAxisConfiguration().getServices();
-                req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+                populateSessionInformation(req);
             }
         } else {
-            HashMap services = configContext.getAxisConfiguration().getServices();
-            req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+            populateSessionInformation(req);
         }
 
         renderView(IN_ACTIVATE_SERVICE_JSP_NAME, req, res);
@@ -471,9 +457,7 @@
     protected void processListServiceGroups(HttpServletRequest req, HttpServletResponse res)
             throws IOException, ServletException {
         Iterator serviceGroups = configContext.getAxisConfiguration().getServiceGroups();
-        HashMap services = configContext.getAxisConfiguration().getServices();
-
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
         req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, serviceGroups);
 
         renderView(LIST_SERVICE_GROUP_JSP, req, res);
@@ -481,8 +465,7 @@
 
     protected void processListService(HttpServletRequest req, HttpServletResponse res)
             throws IOException, ServletException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
         req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
                 configContext.getAxisConfiguration().getFaultyServices());
 
@@ -525,9 +508,7 @@
     }
 
     protected void processSelectService(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
         req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "VIEW");
 
         renderView(SELECT_SERVICE_JSP_NAME, req, res);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisAdminServlet.java Sun Sep  3 17:58:54 2006
@@ -16,6 +16,7 @@
 package org.apache.axis2.transport.http;
 
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.Constants;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -38,6 +39,7 @@
   protected void doGet(HttpServletRequest req,
                          HttpServletResponse resp) throws ServletException, IOException {
         try {
+            req.getSession().setAttribute(Constants.SERVICE_PATH, configContext.getServicePath());
             agent.handle(req, resp);
         } catch (Exception e) {
             throw new ServletException(e);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Sun Sep  3 17:58:54 2006
@@ -68,8 +68,7 @@
     protected transient ServletConfig servletConfig;
 
     private transient ListingAgent agent;
-    public static String SERVICE_PATH;
-    private String contextPath;
+    private String contextRoot;
 
     protected boolean enableRESTInAxis2MainServlet = false;
     protected boolean disableREST = false;
@@ -286,7 +285,6 @@
             listenerManager.addListener(transportInDescription, true);
             ListenerManager.defaultConfigurationContext = configContext;
             agent = new ListingAgent(configContext);
-            SERVICE_PATH = configContext.getServiceContextPath();
 
             initParams();
 
@@ -313,6 +311,18 @@
         if (parameter != null) {
             disableSeperateEndpointForREST = !JavaUtils.isFalseExplicitly(parameter.getValue());
         }
+
+        // HACK ALERT!!! - Is there a better way to get the webapp name?
+        try {
+            String[] array = servletConfig.getServletContext().getResource("/").toString().split("/");
+            contextRoot = array[array.length - 1];
+            configContext.setContextRoot(contextRoot);
+        } catch (Exception e) {
+        }
+        if (contextRoot == null) {
+            contextRoot = "axis2";
+        }
+        this.configContext.setContextRoot(contextRoot);
     }
 
     public void init() throws ServletException {
@@ -402,22 +412,10 @@
             }
         }
         
-        if (contextPath == null) {
-            // HACK ALERT!!! - Is there a better way to get the webapp name?
-            try {
-                String[] array = servletConfig.getServletContext().getResource("/").toString().split("/");
-                contextPath = array[array.length - 1];
-                configContext.setContextRoot(contextPath);
-            } catch (Exception e) {
-            }
-            if (contextPath == null) {
-                contextPath = "axis2";
-            }
-        }
         return new EndpointReference("http://" + ip + ":" + port + '/' +
-                contextPath + "/" + SERVICE_PATH + "/" + serviceName);
+                 configContext.getServiceContextPath() + "/" + serviceName);
     }
-
+    
     protected MessageContext createMessageContext(HttpServletRequest req,
                                                   HttpServletResponse resp) throws IOException {
         MessageContext msgContext = new MessageContext();
@@ -440,7 +438,7 @@
 
         String requestURI = req.getRequestURI();
         if (requestURI.indexOf("rest") != -1) {
-            requestURI = requestURI.replaceFirst("rest", SERVICE_PATH);
+            requestURI = requestURI.replaceFirst("rest", configContext.getServiceContextPath());
         }
         msgContext.setTo(new EndpointReference(requestURI));
         msgContext.setFrom(new EndpointReference(req.getRemoteAddr()));

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/HTTPWorker.java Sun Sep  3 17:58:54 2006
@@ -56,7 +56,7 @@
             final MessageContext msgContext) throws HttpException, IOException {    
 
         ConfigurationContext configurationContext = msgContext.getConfigurationContext();
-        final String contextPath = configurationContext.getContextRoot() + "/";
+        final String contextPath = "/" + configurationContext.getContextRoot() + "/";
         final String servicePath = configurationContext.getServiceContextPath();
 
         HttpVersion ver = request.getRequestLine().getHttpVersion();

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java Sun Sep  3 17:58:54 2006
@@ -44,11 +44,9 @@
     private static final String LIST_FAULTY_SERVICES_JSP_NAME = "listFaultyService.jsp";
 
     public static final String RUNNING_PORT = "RUNNING_PORT";
-    private String servicePath;
 
     public ListingAgent(ConfigurationContext aConfigContext) {
         super(aConfigContext);
-        servicePath = aConfigContext.getServiceContextPath();
     }
 
     private void addTransportListner(String schema, int port) {
@@ -58,7 +56,7 @@
                             new QName(schema));
             if (trsIn == null) {
                 trsIn = new TransportInDescription(new QName(schema));
-                trsIn.setReceiver(new HTTPSTListener(port, schema));
+                trsIn.setReceiver(new HTTPSListener(port, schema));
                 configContext.getListenerManager().addListener(trsIn, true);
             }
         } catch (AxisFault axisFault) {
@@ -147,7 +145,7 @@
                             ip = ip.substring(0, seperatorIndex);
                         }
                     }
-                    ((AxisService) serviceObj).printWSDL2(out, ip, servicePath);
+                    ((AxisService) serviceObj).printWSDL2(out, ip, configContext.getServiceContextPath());
                     out.flush();
                     out.close();
                     return;
@@ -169,7 +167,7 @@
                             ip = ip.substring(0, seperatorIndex);
                         }
                     }
-                    ((AxisService) serviceObj).printWSDL(out, ip, servicePath);
+                    ((AxisService) serviceObj).printWSDL(out, ip, configContext.getServiceContextPath());
                     out.flush();
                     out.close();
                     return;
@@ -229,9 +227,8 @@
     protected void processListServices(HttpServletRequest req,
                                        HttpServletResponse res)
             throws IOException, ServletException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
 
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        populateSessionInformation(req);
         req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
                 configContext.getAxisConfiguration().getFaultyServices());
 
@@ -242,20 +239,20 @@
      * This class is just to add tarnsport at the runtime if user send requet using
      * diffrent schemes , simly to handle http/https seperetaly
      */
-    private class HTTPSTListener implements TransportListener {
+    private class HTTPSListener implements TransportListener {
 
         private int port;
         private String schema;
-        private String contextPath;
+        private ConfigurationContext axisConf;
 
-        public HTTPSTListener(int port, String schema) {
+        public HTTPSListener(int port, String schema) {
             this.port = port;
             this.schema = schema;
         }
 
         public void init(ConfigurationContext axisConf,
                          TransportInDescription transprtIn) throws AxisFault {
-            contextPath = axisConf.getServiceContextPath();
+            this.axisConf = axisConf;
         }
 
         public void start() throws AxisFault {
@@ -265,7 +262,7 @@
         }
 
         public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
-            return new EndpointReference(schema + "://" + ip + ":" + port + contextPath + "/" + serviceName);
+            return new EndpointReference(schema + "://" + ip + ":" + port + "/" + axisConf.getServiceContextPath() + "/" + serviceName);
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java Sun Sep  3 17:58:54 2006
@@ -57,7 +57,6 @@
     public static int DEFAULT_PORT = 8080;
 
     private String hostAddress = null;
-    private String contextPath;
 
     protected ConfigurationContext configurationContext;
     protected HttpFactory httpFactory;
@@ -82,7 +81,6 @@
         TransportInDescription httpDescription = new TransportInDescription(new QName(Constants.TRANSPORT_HTTP));
         httpDescription.setReceiver(this);
         httpFactory.getListenerManager().addListener(httpDescription, true);
-        contextPath = configurationContext.getServiceContextPath();
     }
 
     /**
@@ -109,8 +107,6 @@
                 hostAddress = ((String) param.getValue()).trim();
             else
                 hostAddress = httpFactory.getHostAddress();
-
-            contextPath = configurationContext.getServiceContextPath();
         } catch (Exception e1) {
             throw new AxisFault(e1);
         }
@@ -233,7 +229,7 @@
         //if host address is present
         if (hostAddress != null) {
             if (embedded != null) {
-                return new EndpointReference(hostAddress + contextPath + "/" + serviceName);
+                return new EndpointReference(hostAddress + "/" + configurationContext.getServiceContextPath() + "/" + serviceName);
             } else {
                 throw new AxisFault("Unable to generate EPR for the transport : http");
             }
@@ -255,7 +251,7 @@
         if (embedded != null) {
             return new EndpointReference("http://" + localAddress + ":" +
                     (embedded.getPort())
-                    + contextPath + "/" + serviceName);
+                    + "/" + configurationContext.getServiceContextPath() + "/" + serviceName);
         } else {
             throw new AxisFault("Unable to generate EPR for the transport : http");
         }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java Sun Sep  3 17:58:54 2006
@@ -64,7 +64,6 @@
     private String port;
     private String replyTo;
     private String user;
-    private String servicePath;
 
     public SimpleMailListener() {
     }
@@ -103,7 +102,6 @@
             listenerManager.init(configurationContext);
         }
         listenerManager.addListener(trsIn, true);
-        servicePath = configurationContext.getServiceContextPath();
     }
 
     /*
@@ -118,7 +116,6 @@
         password = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_PASSWORD));
         port = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.POP3_PORT));
         replyTo = Utils.getParameterValue(transportIn.getParameter(MailSrvConstants.RAPLY_TO));
-        servicePath = configurationContext.getServiceContextPath();
         if ((user == null) || (host == null) || (password == null) || (port == null)) {
             if (this.user == null) {
                 throw new AxisFault(Messages.getMessage("canNotBeNull", "User"));
@@ -281,7 +278,7 @@
      * @see org.apache.axis2.transport.TransportListener#replyToEPR(java.lang.String)
      */
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
-        return new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + "/" + servicePath + "/" + serviceName);//Constants.TRANSPORT_MAIL + 
+        return new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + "/" + configurationContext.getServiceContextPath() + "/" + serviceName);//Constants.TRANSPORT_MAIL + 
     }
 
     public void setDoThreads(boolean value) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java Sun Sep  3 17:58:54 2006
@@ -48,7 +48,7 @@
     private ConfigurationContext configContext;
     private ServerSocket serversocket;
     private String hostAddress = null;
-    private String conetxtPath;
+    private String contextPath;
 
     public TCPServer() {
     }
@@ -67,7 +67,7 @@
                 listenerManager.init(configContext);
             }
             listenerManager.addListener(trsIn, true);
-            conetxtPath = configContext.getServiceContextPath();
+            contextPath = configContext.getServiceContextPath();
 
         } catch (IOException e1) {
             throw new AxisFault(e1);
@@ -91,7 +91,7 @@
         if (param != null) {
             hostAddress = ((String) param.getValue()).trim();
         }
-        conetxtPath = configContext.getServiceContextPath();
+        contextPath = configContext.getServiceContextPath();
     }
 
     public static void main(String[] args) throws AxisFault, NumberFormatException {
@@ -188,7 +188,7 @@
         if (hostAddress != null) {
             if (serversocket != null) {
                 // todo this has to fix
-                return new EndpointReference(hostAddress + conetxtPath + serviceName);
+                return new EndpointReference(hostAddress + "/" + contextPath + serviceName);
             } else {
                 log.debug("Unable to generate EPR for the transport tcp");
                 return null;
@@ -204,7 +204,7 @@
         if (serversocket != null) {
             // todo this has to fix
             return new EndpointReference("tcp://" + ip + ":" + (serversocket.getLocalPort())
-                    + conetxtPath + "/" + serviceName);
+                    + "/" + contextPath + "/" + serviceName);
         } else {
             log.debug("Unable to generate EPR for the transport tcp");
             return null;

Modified: webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/HappyAxis.jsp Sun Sep  3 17:58:54 2006
@@ -23,6 +23,7 @@
 <%@ page import="java.io.IOException" %>
 <%@ page import="java.io.InputStream" %>
 <%@ page import="java.io.StringWriter" %>
+<%@ page import="org.apache.axis2.deployment.WarBasedAxisConfigurator"%>
 
 <%
     /*
@@ -50,17 +51,7 @@
 <body>
 <jsp:include page="include/header.inc"/>
 <jsp:include page="include/link-footer.jsp"/>
-<%port = request.getServerPort();%>
-<%
-    // since this one is an internal request we do not use public frontendHostUrl
-    // for it
-    IP = request.getRequestURL().toString();
-    int lastindex = IP.lastIndexOf('/');
-    IP = IP.substring(0, lastindex);
-    ///axis2/axis2-web/services/version
-    IP = IP.replaceAll("axis2-web", "");
-    targetEPR = new EndpointReference(IP + AxisServlet.SERVICE_PATH + "/version");
-%>
+<%IP = request.getRequestURL().toString();%>
 <%!
     /*
     * Happiness tests for axis2. These look at the classpath and warn if things
@@ -68,9 +59,7 @@
     * but here we want to validate JSP compilation too, and have a drop-in
     * page for easy re-use
     */
-    int port = 0;
     String IP;
-    EndpointReference targetEPR;
 
     /**
      * Get a string providing install information.
@@ -347,10 +336,18 @@
 
     public boolean inVokeTheService() {
         try {
+            // since this one is an internal request we do not use public frontendHostUrl
+            // for it
+            int lastindex = IP.lastIndexOf('/');
+            IP = IP.substring(0, lastindex);
+            ///axis2/axis2-web/services/version
+            IP = IP.replaceAll("axis2-web", "");
+            
             OMElement payload = createEnvelope();
             ConfigurationContext configctx =
                     ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
             ServiceClient client = new ServiceClient(configctx, null);
+            EndpointReference targetEPR = new EndpointReference(IP + configctx.getServicePath() + "/version");
             Options options = new Options();
             client.setOptions(options);
             options.setTo(targetEPR);

Modified: webservices/axis2/trunk/java/modules/webapp/listFaultyService.jsp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/webapp/listFaultyService.jsp?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/listFaultyService.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/listFaultyService.jsp Sun Sep  3 17:58:54 2006
@@ -15,7 +15,7 @@
   <jsp:include page="include/header.inc"></jsp:include>
     <jsp:include page="include/link-footer.jsp"></jsp:include>
   <%
-        String prifix = request.getAttribute("frontendHostUrl") + AxisServlet.SERVICE_PATH +"services/";
+        String prifix = request.getAttribute("frontendHostUrl") + (String)request.getSession().getAttribute(Constants.SERVICE_PATH) +"services/";
         String restprefix = request.getAttribute("frontendHostUrl") + "rest/";
     %>
         <%

Modified: webservices/axis2/trunk/java/modules/webapp/listGroupService.jsp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/webapp/listGroupService.jsp?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/listGroupService.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/listGroupService.jsp Sun Sep  3 17:58:54 2006
@@ -19,7 +19,7 @@
 </jsp:include>
 <h1>Available services</h1>
 <%
-  String prifix = request.getAttribute("frontendHostUrl") + AxisServlet.SERVICE_PATH +"/";
+  String prifix = request.getAttribute("frontendHostUrl") + (String)request.getSession().getAttribute(Constants.SERVICE_PATH) +"/";
 %>
 <%
   HashMap serviceMap = (HashMap) request.getSession().getAttribute(Constants.SERVICE_MAP);

Modified: webservices/axis2/trunk/java/modules/webapp/listService.jsp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/webapp/listService.jsp?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/listService.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/listService.jsp Sun Sep  3 17:58:54 2006
@@ -36,7 +36,7 @@
 <jsp:include page="include/adminheader.jsp"/>
 
 <h1>Available Services</h1>
-<% String prefix = request.getAttribute("frontendHostUrl") + AxisServlet.SERVICE_PATH + "/";
+<% String prefix = request.getAttribute("frontendHostUrl") + (String)request.getSession().getAttribute(Constants.SERVICE_PATH) + "/";
     String restPrefix = request.getAttribute("frontendHostUrl") + "rest/";
 %>
 <%

Modified: webservices/axis2/trunk/java/modules/webapp/listServices.jsp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/webapp/listServices.jsp?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/listServices.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/listServices.jsp Sun Sep  3 17:58:54 2006
@@ -34,7 +34,7 @@
 <jsp:include page="include/header.inc" />
 <jsp:include page="include/link-footer.jsp" />
 <h1>Available services</h1>
-<% String prefix = request.getAttribute("frontendHostUrl") + AxisServlet.SERVICE_PATH + "/";
+<% String prefix = request.getAttribute("frontendHostUrl") + (String)request.getSession().getAttribute(Constants.SERVICE_PATH) + "/";
     String restPrefix = request.getAttribute("frontendHostUrl") + "rest/";
 %>
 <%

Modified: webservices/axis2/trunk/java/modules/webapp/listSingleService.jsp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/webapp/listSingleService.jsp?view=diff&rev=439892&r1=439891&r2=439892
==============================================================================
--- webservices/axis2/trunk/java/modules/webapp/listSingleService.jsp (original)
+++ webservices/axis2/trunk/java/modules/webapp/listSingleService.jsp Sun Sep  3 17:58:54 2006
@@ -11,7 +11,7 @@
 <jsp:include page="include/adminheader.jsp"/>
 <h1>List Single service</h1>
 <%
-    String prefix = request.getAttribute("frontendHostUrl") + AxisServlet.SERVICE_PATH + "/";
+    String prefix = request.getAttribute("frontendHostUrl") + (String)request.getSession().getAttribute(Constants.SERVICE_PATH) + "/";
     String restPrefix = request.getAttribute("frontendHostUrl") + "rest/";
 %>
 <%



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org