You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by di...@apache.org on 2007/01/31 23:06:07 UTC

svn commit: r502017 - in /geronimo/server/trunk/modules: geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/ geronimo-axis2/src/main/java/org/apache/geronimo/axis2/

Author: dims
Date: Wed Jan 31 14:06:06 2007
New Revision: 502017

URL: http://svn.apache.org/viewvc?view=rev&rev=502017
Log:
Fix for   GERONIMO-2789 - allow users to specify something other than services in url-pattern in axis2 jax-ws wars

Modified:
    geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/PortInfo.java

Modified: geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java?view=diff&rev=502017&r1=502016&r2=502017
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2-builder/src/main/java/org/apache/geronimo/axis2/builder/Axis2Builder.java Wed Jan 31 14:06:06 2007
@@ -148,7 +148,7 @@
                     String servlet = port.getServiceImplBean().getServletLink().getValue();
                     String sei = port.getServiceEndpointInterface().getValue();
                     String portName = port.getPortComponentName().getValue();
-
+                    String urlpattern = (String) correctedPortLocations.get(servlet);
                     PortInfo portInfo = new PortInfo();
 
                     portInfo.setServiceName(serviceName);
@@ -157,7 +157,7 @@
                     portInfo.setPortName(portName);
                     portInfo.setWsdlFile(wsdlFile);
                     portInfo.setHandlers(port.getHandler());
-                    
+                    portInfo.setURLPattern(urlpattern);
                     map.put(servlet, portInfo);
                 }
             }
@@ -178,8 +178,12 @@
         // assert pi instanceof PortInfo : "received incorrect portInfo object";
 
         Map sharedContext = ((WebModule) module).getSharedContext();
+        String contextRoot = ((WebModule) module).getContextRoot();
         Map portInfoMap = (Map) sharedContext.get(KEY);
         PortInfo portInfo = (PortInfo) portInfoMap.get(servletName);
+        
+        processURLPattern(contextRoot, portInfo);
+        
         if (portInfo == null) {
             // not ours
             return false;
@@ -226,6 +230,32 @@
         return new ArrayList<Handler>();
     }
 
+    private void processURLPattern(String contextRoot, PortInfo portInfo) throws DeploymentException {
+        //if the user specifies a url-pattern, set it here. 
+        String oldup = portInfo.getURLPattern();
+        if (oldup == null || oldup.length() == 0) { 
+            //if we cannot grab a valid urlpattern, default it to the port-component-name.
+            portInfo.setURLPattern(portInfo.getPortName());   
+        } else {
+            int i = oldup.indexOf(contextRoot);
+            oldup = oldup.substring(i + contextRoot.length() + 1);
+            oldup = oldup.trim();
+            if (oldup.indexOf("*") > 0) {
+                //uncomment this before we fix this issue.  workarond by assuming * is at the end.
+                //throw new DeploymentException("Per JSR 109, the url-pattern should not contain an asterisk.");
+                oldup = oldup.substring(0, oldup.length() - 1);
+            } 
+            //trim the forward slashes at the beginning or end.
+            if (oldup.substring(0, 1).equalsIgnoreCase("/")) {
+                oldup = oldup.substring(1);
+            } 
+            if (oldup.substring(oldup.length()-1).equalsIgnoreCase("/")) {
+                oldup = oldup.substring(0, oldup.length() - 1);
+            }
+        
+            portInfo.setURLPattern(oldup);
+        } 
+    }
     public static final GBeanInfo GBEAN_INFO;
 
     static {

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=502017&r1=502016&r2=502017
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java Wed Jan 31 14:06:06 2007
@@ -119,6 +119,7 @@
             AxisService service = null;
             
             configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
+            configurationContext.setServicePath(portInfo.getURLPattern());
           
             if(wsdlDefinition != null){ //WSDL Has been provided
            		WSDLToAxisServiceBuilder wsdlBuilder = null;

Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/PortInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/PortInfo.java?view=diff&rev=502017&r1=502016&r2=502017
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/PortInfo.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/PortInfo.java Wed Jan 31 14:06:06 2007
@@ -1,87 +1,96 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.geronimo.axis2;
-
-import org.apache.axis2.jaxws.javaee.PortComponentHandlerType;
-
-import java.io.Serializable;
-import java.util.List;
-
-
-public class PortInfo implements Serializable {
-
-    private String serviceName;
-    private String portName;
-    private String seiInterfaceName;
-    private String wsdlFile;
-    private String servletLink;
-
-    private List<PortComponentHandlerType> handlers;
-
-    public String getPortName() {
-        return portName;
-    }
-
-    public void setPortName(String pn) {
-        portName = pn;
-    }
-
-    public String getServiceEndpointInterfaceName() {
-        return seiInterfaceName;
-    }
-
-    public void setServiceEndpointInterfaceName(String sei) {
-        seiInterfaceName = sei;
-    }
-
-    public String getServletLink() {
-        return servletLink;
-    }
-
-    public void setServletLink(String sl) {
-        servletLink = sl;
-    }
-
-    public String getWsdlFile() {
-        return wsdlFile;
-    }
-
-    public void setWsdlFile(String wf) {
-        wsdlFile = wf;
-    }
-
-    public void setHandlers(List<PortComponentHandlerType> h) {
-        handlers = h;
-    }
-
-    public List<PortComponentHandlerType> getHandlers() {
-        return handlers;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public void setServiceName(String sn) {
-        serviceName = sn;
-    }
-
-    public String toString() {
-        return "[" + serviceName + ":" + portName + ":" + seiInterfaceName + ":" + wsdlFile + "]";
-    }
-}
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.axis2;
+
+import org.apache.axis2.jaxws.javaee.PortComponentHandlerType;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+public class PortInfo implements Serializable {
+
+    private String serviceName;
+    private String portName;
+    private String seiInterfaceName;
+    private String wsdlFile;
+    private String servletLink;
+    private String urlpattern;
+
+    private List<PortComponentHandlerType> handlers;
+
+    public String getPortName() {
+        return portName;
+    }
+
+    public void setPortName(String pn) {
+        portName = pn;
+    }
+
+    public String getServiceEndpointInterfaceName() {
+        return seiInterfaceName;
+    }
+
+    public void setServiceEndpointInterfaceName(String sei) {
+        seiInterfaceName = sei;
+    }
+
+    public String getServletLink() {
+        return servletLink;
+    }
+
+    public void setServletLink(String sl) {
+        servletLink = sl;
+    }
+
+    public String getWsdlFile() {
+        return wsdlFile;
+    }
+
+    public void setWsdlFile(String wf) {
+        wsdlFile = wf;
+    }
+
+    public void setHandlers(List<PortComponentHandlerType> h) {
+        handlers = h;
+    }
+
+    public List<PortComponentHandlerType> getHandlers() {
+        return handlers;
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public void setServiceName(String sn) {
+        serviceName = sn;
+    }
+    
+    public String getURLPattern() {
+        return urlpattern;
+    }
+    
+    public void setURLPattern(String up) {
+        urlpattern = up;
+    }
+
+    public String toString() {
+        return "[" + serviceName + ":" + portName + ":" + seiInterfaceName + ":" + wsdlFile + ":" + urlpattern + "]";
+    }
+}