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 sa...@apache.org on 2007/05/15 09:35:02 UTC

svn commit: r538078 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java

Author: saminda
Date: Tue May 15 00:35:01 2007
New Revision: 538078

URL: http://svn.apache.org/viewvc?view=rev&rev=538078
Log:
Finding the context root from the first request for the servlet. The 
logic has been 
improved.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java

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=538078&r1=538077&r2=538078
==============================================================================
--- 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 Tue May 15 00:35:01 2007
@@ -492,32 +492,14 @@
         if (contextRoot != null && contextRoot.trim().length() != 0) {
             return;
         }
-        boolean findContext = true;
-        String findContextParameter = servletConfig.getInitParameter("axis2.find.context");
-        if (findContextParameter != null) {
-            findContextParameter = findContextParameter.trim();
-            findContext = JavaUtils.isTrue(findContextParameter);
-        }
-        if (!findContext) {
-            if (contextRoot == null) {
-                contextRoot = configContext.getContextRoot();
-            }
-        }
-        if (contextRoot == null || contextRoot.trim().length() == 0) {
-            String[] parts = JavaUtils.split(req.getContextPath(), '/');
-            if (parts != null) {
-                for (int i = 0; i < parts.length; i++) {
-                    if (parts[i].length() > 0) {
-                        contextRoot = parts[i];
-                        break;
-                    }
-                }
-            }
-            if (contextRoot == null || req.getContextPath().equals("/")) {
-                contextRoot = "/";
-            }
-            configContext.setContextRoot(contextRoot);
+        String contextPath = req.getContextPath();
+        //handling ROOT scenario, for servlets in the default (root) context, this method returns ""
+        if (contextPath != null && contextPath.length() == 0) {
+           contextPath = "/";
         }
+        this.contextRoot = contextPath;
+
+        configContext.setContextRoot(contextRoot);
     }
 
     /**



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