tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r569074 - in /incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2: Axis2ServiceServlet.java TuscanyListingAgent.java
Date Thu, 23 Aug 2007 17:08:15 GMT
Author: antelder
Date: Thu Aug 23 10:08:14 2007
New Revision: 569074

URL: http://svn.apache.org/viewvc?rev=569074&view=rev
Log:
Fix ?wsdl for webapps, slightly hacky all gets much cleaner when we move up to Axis2 1.3

Modified:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java?rev=569074&r1=569073&r2=569074&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
Thu Aug 23 10:08:14 2007
@@ -35,13 +35,13 @@
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import org.apache.axis2.transport.http.server.HttpUtils;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.transport.http.AxisServlet;
 import org.apache.axis2.transport.http.ListingAgent;
-import org.apache.axis2.transport.http.server.HttpUtils;
 
 /**
  * This overrides the servlet init of the AxisServlet so Tuscany can use
@@ -267,6 +267,7 @@
 
     /**
      * Override the AxisServlet method so as to not add "/services" into the url
+     * and to work with Tuscany service names. can go once moved to Axis2 1.3
      */
     @Override
     public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
@@ -286,14 +287,26 @@
             }
         }
 
-
-        StringBuilder eprString = new StringBuilder("http://");
-        eprString.append(ip).append(":").append(port);
+        String cp = configContext.getServiceContextPath();
+        if (cp.endsWith("_null_")) {
+            cp = cp.substring(0, cp.length()-6);    
+        }
         if (!serviceName.startsWith("/")) {
-            eprString.append('/');
+            serviceName = "/" + serviceName;
         }
-        eprString.append(serviceName);
-        EndpointReference endpoint = new EndpointReference(eprString.toString());
+        String name;
+        if (cp.equals("/")) {
+            name = serviceName;
+        } else {
+            name = cp + serviceName;
+        }
+
+        EndpointReference endpoint =
+            new EndpointReference("http://" + ip
+                + ":"
+                + port
+                + (name.startsWith("/")? "" : "/")
+                + name);
 
         return new EndpointReference[]{endpoint};
     }

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java?rev=569074&r1=569073&r2=569074&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
Thu Aug 23 10:08:14 2007
@@ -99,6 +99,7 @@
 // this line is the only change to to Axis2 code
 
         String serviceName = findAxisServiceName(filePart);
+        setContextRoot(filePart, serviceName);
 
         String query = req.getQueryString();
         int wsdl2 = query.indexOf("wsdl2");
@@ -268,6 +269,25 @@
         }
 
         renderView(LIST_SINGLE_SERVICE_JSP_NAME, req, res);
+    }
+
+    /**
+     * Hack for Tuscany to get ?wsdl working with Tuscany service names
+     * Can go once moved up to Axis2 1.3
+     */
+    private void setContextRoot(String filePart, String serviceName) {
+        String contextRoot = configContext.getContextRoot();
+        if (contextRoot != null && contextRoot.length() > 0) {
+            if (contextRoot.equals("/")) {
+                configContext.setServicePath("_null_");
+            } else {
+                int i = filePart.indexOf(contextRoot) + contextRoot.length();
+                int j = filePart.lastIndexOf(serviceName);
+                String mapping = filePart.substring(i+1, j);
+                configContext.setServicePath(mapping);
+            }
+            configContext.setContextRoot(contextRoot);
+        }
     }
 
     private String extractHostAndPort(String filePart, boolean isHttp) {



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


Mime
View raw message