You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by da...@apache.org on 2007/04/23 07:56:45 UTC

svn commit: r531341 - in /incubator/cxf/trunk: distribution/src/main/assembly/ distribution/src/main/release/lib/ distribution/src/main/release/samples/spring_http/ distribution/src/main/release/samples/spring_http/src/demo/ distribution/src/main/relea...

Author: dandiep
Date: Sun Apr 22 22:56:43 2007
New Revision: 531341

URL: http://svn.apache.org/viewvc?view=rev&rev=531341
Log:
o Change the servlet transport to look up services only by their
  path. This means we don't have to put the context name in the 
  address now, which means the samples will work correctly.
o Allow CXFServlet to set the defaultbus. If you don't do this, it
  breaks some Spring use cases. I also changed it so we ALWAYS create
  a Bus (unless the bus id was specified). This should prevent
  conflicts across servlet instances, which seems to be what the 
  previous code was trying to prevent.
o Add missing build.xml for spring_http sample and rework its directory
  structure to be like the other samples.

Added:
    incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml   (with props)
    incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/
      - copied from r531063, incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/
    incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/webapp/
      - copied from r531063, incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/webapp/
Removed:
    incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/
    incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/webapp/
Modified:
    incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
    incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
    incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java

Modified: incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/assembly/bin.xml?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/assembly/bin.xml (original)
+++ incubator/cxf/trunk/distribution/src/main/assembly/bin.xml Sun Apr 22 22:56:43 2007
@@ -35,6 +35,7 @@
 				<include>LICENSE</include>
 				<include>licenses/*.*</include>
 				<include>modules/*</include>
+				<include>lib/*</include>
 				<include>README</include>
 			</includes>
 		</fileSet>

Modified: incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS (original)
+++ incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS Sun Apr 22 22:56:43 2007
@@ -47,6 +47,11 @@
 - stax-utils.jar
 
 For WS-Security support:
+- bcprov-jdk14.jar
 - wss4j.jar
 - xalan.jar
-- xmlsec.jar
\ No newline at end of file
+- xmlsec.jar
+
+For HTTP Binding support:
+- jra.jar
+- jettison.jar (Needed for JSON services only)

Added: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml?view=auto&rev=531341
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml (added)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml Sun Apr 22 22:56:43 2007
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project name="Spring HTTP Servlet demo" default="build" basedir=".">
+
+
+	<import file="../common_build.xml"/>        
+
+    <target name="client" description="run demo client" depends="build">
+        <property name="param" value=""/>
+        <cxfrun classname="demo.spring.client.Client" />
+    </target> 
+        
+    <target name="server" description="run demo server" depends="build">
+        <cxfrun classname="demo.spring.servlet.Server"/>
+    </target>
+
+    <property name="cxf.war.file.name" value="spring_http"/>
+      <target name="war" depends="build">
+	  <cxfwar filename="${cxf.war.file.name}.war"/>
+    </target>
+</project>

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java?view=diff&rev=531341&r1=531063&r2=531341
==============================================================================
--- incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java (original)
+++ incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java Sun Apr 22 22:56:43 2007
@@ -46,7 +46,7 @@
         WebAppContext webappcontext = new WebAppContext();
         webappcontext.setContextPath("/");
 
-        webappcontext.setWar("src/webapp");
+        webappcontext.setWar("webapp");
 
         HandlerCollection handlers = new HandlerCollection();
         handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java Sun Apr 22 22:56:43 2007
@@ -78,9 +78,6 @@
     public void init(ServletConfig servletConfig) throws ServletException {
         super.init(servletConfig);
 
-        BusFactory.setDefaultBus(null);
-        BusFactory.setThreadDefaultBus(null);
-        
         String busid = servletConfig.getInitParameter("bus.id");
         if (null != busid) {
             WeakReference<Bus> ref = BUS_MAP.get(busid);
@@ -101,13 +98,11 @@
         if (null != busid) {
             BUS_MAP.put(busid, new WeakReference<Bus>(bus));
         }
-        BusFactory.setDefaultBus(null);
-        BusFactory.setThreadDefaultBus(null);
     }
     
     private void loadBusNoConfig(ServletConfig servletConfig) throws ServletException {
         if (bus == null) {
-            bus = BusFactory.getDefaultBus();
+            bus = BusFactory.newInstance().createBus();
         }
         ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
         resourceManager.addResourceResolver(new ServletContextResourceResolver(

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Sun Apr 22 22:56:43 2007
@@ -22,7 +22,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Collection;
-import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -46,32 +45,11 @@
 
     private ServletTransportFactory transport;
     private CXFServlet cxfServlet;
-    private String lastBase = "";
  
     public ServletController(ServletTransportFactory df, CXFServlet servlet) {
         this.transport = df;
         this.cxfServlet = servlet;
     }
-    
-    private synchronized void updateDests(HttpServletRequest request) {
-        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
-        String base = request.getRequestURL().toString();
-        base = base.substring(0, base.length() - pathInfo.length());
-        
-        if (base.equals(lastBase)) {
-            return;
-        }
-        Set<String> paths = transport.getDestinationsPaths();
-        for (String path : paths) {
-            ServletDestination d2 = transport.getDestinationForPath(path);
-            String ad = d2.getEndpointInfo().getAddress();
-            if (ad.equals(path)
-                || ad.equals(lastBase + path)) {
-                d2.getEndpointInfo().setAddress(base + path);
-            }
-        }
-        lastBase = base;
-    }
 
     public void invoke(HttpServletRequest request, HttpServletResponse res) throws ServletException {
         try {
@@ -82,7 +60,6 @@
             ServletDestination d = (ServletDestination)transport.getDestination(ei);
 
             if (d.getMessageObserver() == null) {
-                updateDests(request);
                 if (request.getRequestURI().endsWith("services")
                     || request.getRequestURI().endsWith("services/")
                     || StringUtils.isEmpty(request.getPathInfo())
@@ -93,7 +70,6 @@
                     generateNotFound(request, res);
                 }
             } else {
-                updateDests(request);
                 ei = d.getEndpointInfo();
                 Bus bus = cxfServlet.getBus();
                 if (null != request.getQueryString() 
@@ -133,14 +109,20 @@
         response.setContentType("text/html");        
         response.getWriter().write("<html><body>");
         
-        String reqPerfix = request.getRequestURL().toString();
-        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
-        reqPerfix = reqPerfix.substring(0, reqPerfix.length() - pathInfo.length());
+        String reqPerfix = getBaseURL(request);
         
         if (destinations.size() > 0) {  
             for (ServletDestination sd : destinations) {
                 if (null != sd.getEndpointInfo().getName()) {
-                    String address = sd.getEndpointInfo().getAddress();
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(reqPerfix);
+                    String path = sd.getAddressPath();
+                    if (reqPerfix.endsWith("/")) {
+                        path = path.substring(1);
+                    }
+                    sb.append(path);
+                    
+                    String address = sb.toString();
                     response.getWriter().write("<p> <a href=\"" + address + "?wsdl\">");
                     response.getWriter().write(sd.getEndpointInfo().getName() + "</a> </p>");
                 }    
@@ -149,6 +131,13 @@
             response.getWriter().write("No service was found.");
         }
         response.getWriter().write("</body></html>");
+    }
+
+    private String getBaseURL(HttpServletRequest request) {
+        String reqPerfix = request.getRequestURL().toString();
+        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
+        reqPerfix = reqPerfix.substring(0, reqPerfix.length() - pathInfo.length());
+        return reqPerfix;
     }
 
     protected void generateNotFound(HttpServletRequest request, HttpServletResponse res) throws IOException {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Sun Apr 22 22:56:43 2007
@@ -101,7 +101,20 @@
             }
         }        
     }
-   
+
+    public String getAddressPath() {
+        String path = endpointInfo.getAddress();
+        String lh = "http://localhost/";
+        String lhs = "https://localhost/";
+        
+        if (path.startsWith(lh)) {
+            path = "/" + path.substring(lh.length());
+        } else if (path.startsWith(lhs)) {
+            path = "/" + path.substring(lhs.length());
+        }
+        return path;
+    }
+    
     public MessageObserver getMessageObserver() {
         return this.incomingObserver;
     }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Sun Apr 22 22:56:43 2007
@@ -60,16 +60,28 @@
     
     public Destination getDestination(EndpointInfo endpointInfo)
         throws IOException {
-        ServletDestination d = destinations.get(endpointInfo.getAddress());
+        ServletDestination d = getDestinationForPath(endpointInfo.getAddress());
         if (d == null) { 
             d = new ServletDestination(bus, null, endpointInfo);
-            destinations.put(endpointInfo.getAddress(), d);
+            destinations.put(getTrimmedPath(endpointInfo.getAddress()), d);
         }
         return d;
     }
     
     public ServletDestination getDestinationForPath(String path) {
-        return destinations.get(path);
+        return destinations.get(getTrimmedPath(path));
+    }
+
+    private String getTrimmedPath(String path) {
+        String lh = "http://localhost/";
+        String lhs = "https://localhost/";
+        
+        if (path.startsWith(lh)) {
+            path = "/" + path.substring(lh.length());
+        } else if (path.startsWith(lhs)) {
+            path = "/" + path.substring(lhs.length());
+        }
+        return path;
     }
     
     public Collection<ServletDestination> getDestinations() {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java Sun Apr 22 22:56:43 2007
@@ -19,10 +19,7 @@
 package org.apache.cxf.systest.servlet;
 
 import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Field;
 import java.net.MalformedURLException;
-import java.util.Map;
 
 import org.xml.sax.SAXException;
 
@@ -33,10 +30,7 @@
 import com.meterware.servletunit.ServletRunner;
 import com.meterware.servletunit.ServletUnitClient;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.test.AbstractCXFTest;
-import org.apache.cxf.transport.servlet.CXFServlet;
 import org.junit.Before;
 
 public abstract class AbstractServletTest extends AbstractCXFTest {
@@ -52,13 +46,6 @@
         } catch (HttpNotFoundException e) {
             // ignore, we just want to boot up the servlet
         }   
-        
-        Field f = CXFServlet.class.getDeclaredField("BUS_MAP");
-        f.setAccessible(true);
-        Map<String, WeakReference<Bus>> obj = CastUtils.cast((Map<?, ?>)f.get(null));
-        if (obj.containsKey("servlet.systest.bus.id")) {
-            bus = obj.get("servlet.systest.bus.id").get();
-        }
         
         HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);        
     } 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java Sun Apr 22 22:56:43 2007
@@ -29,6 +29,8 @@
 import com.meterware.httpunit.WebResponse;
 import com.meterware.servletunit.ServletUnitClient;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.service.invoker.BeanInvoker;
@@ -38,13 +40,18 @@
 
 public class CXFServletTest extends AbstractServletTest {
     
+    @Override
+    protected Bus createBus() throws BusException {
+        return null;
+    }
+
     // Create the JaxWsService with the JaxWsServerFactoryBean
     protected void setupJaxwsService() {
         JaxWsServerFactoryBean svr = new JaxWsServerFactoryBean();
         URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
         assertNotNull(resource);
         svr.getServiceFactory().setWsdlURL(resource.toString());
-        svr.setBus(getBus());
+//        svr.setBus(getBus());
         svr.setServiceClass(GreeterImpl.class);
         svr.setAddress("http://localhost/services/Greeter");
         GreeterImpl greeter = new GreeterImpl();

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java Sun Apr 22 22:56:43 2007
@@ -24,11 +24,18 @@
 import com.meterware.httpunit.WebRequest;
 import com.meterware.httpunit.WebResponse;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
 import org.apache.cxf.helpers.DOMUtils;
 import org.junit.Test;
 
 public class ExternalServicesServletTest extends AbstractServletTest {
     
+    @Override
+    protected Bus createBus() throws BusException {
+        return null;
+    }
+
     @Override
     protected String getConfiguration() {
         return "/org/apache/cxf/systest/servlet/web-external.xml";



Re: svn commit: r531341 - in /incubator/cxf/trunk: distribution/src/main/assembly/ distribution/src/main/release/lib/ distribution/src/main/release/samples/spring_http/ distribution/src/main/release/samples/spring_http/src/demo/ distribution/src/main/relea...

Posted by Daniel Kulp <dk...@apache.org>.
James,

Yea, this commit broke a BUNCH of things for me too.   When I get in in 
the morning, this will be my #1 priority to get straightened out.   I'll 
test the servlet stuff at that point.    

Dan



On Monday 23 April 2007 03:55, James Mao wrote:
> Hi Dan,
>
> After this fix, i got:
>
> client-servlet:
>      [java] http://localhost:8080/helloworld/services/hello_world?wsdl
>      [java] Invoking sayHi...
>      [java] Exception in thread "main"
> javax.xml.ws.WebServiceException: org.apa
> che.cxf.interceptor.Fault: Could not send Message.
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:134)
>      [java]     at $Proxy34.sayHi(Unknown Source)
>      [java]     at demo.hw.client.Client.main(Client.java:60)
>      [java] Caused by: org.apache.cxf.interceptor.Fault: Could not
> send Message.
>
>      [java]     at
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMes
> sage(MessageSenderInterceptor.java:47)
>      [java]     at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
> nterceptorChain.java:148)
>      [java]     at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:215
> )
>      [java]     at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
> va:73)
>      [java]     at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
> .java:122)
>      [java]     ... 2 more
>      [java] Caused by: java.net.MalformedURLException: no protocol:
> /hello_world
>
>      [java]     at java.net.URL.<init>(URL.java:567)
>      [java]     at java.net.URL.<init>(URL.java:464)
>      [java]     at java.net.URL.<init>(URL.java:413)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPCondui
> t.java:611)
>      [java]     at
> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit
> .java:440)
>      [java]     at
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMes
> sage(MessageSenderInterceptor.java:45)
>      [java]     ... 6 more
>      [java] Java Result: 1
>
> The previous problem is just the URL problems, to fix the problem,
> what we need is modify the cxf-servlet.xml
> change the jaxws:address from "/services/helloworld" to "/helloworld"
>
> But now seems the whole demo is broken.
>
> James.
>
> > Author: dandiep
> > Date: Sun Apr 22 22:56:43 2007
> > New Revision: 531341
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=531341
> > Log:
> > o Change the servlet transport to look up services only by their
> >   path. This means we don't have to put the context name in the
> >   address now, which means the samples will work correctly.
> > o Allow CXFServlet to set the defaultbus. If you don't do this, it
> >   breaks some Spring use cases. I also changed it so we ALWAYS
> > create a Bus (unless the bus id was specified). This should prevent
> > conflicts across servlet instances, which seems to be what the
> > previous code was trying to prevent.
> > o Add missing build.xml for spring_http sample and rework its
> > directory structure to be like the other samples.
> >
> > Added:
> >    
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml   (with props)
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/demo/ - copied from r531063,
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/main/java/demo/
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/webapp/ - copied from r531063,
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/webapp/ Removed:
> >    
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/main/java/demo/
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/webapp/ Modified:
> >     incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
> >     incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
> >    
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/demo/spring/servlet/Server.java
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/CXFServlet.java
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletController.java
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletDestination.java
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletTransportFactory.java
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/AbstractServletTest.java
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/CXFServletTest.java
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/ExternalServicesServletTest.java
> >
> > Modified: incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
> > URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/ma
> >in/assembly/bin.xml?view=diff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
> > (original) +++
> > incubator/cxf/trunk/distribution/src/main/assembly/bin.xml Sun Apr
> > 22 22:56:43 2007 @@ -35,6 +35,7 @@
> >  				<include>LICENSE</include>
> >  				<include>licenses/*.*</include>
> >  				<include>modules/*</include>
> > +				<include>lib/*</include>
> >  				<include>README</include>
> >  			</includes>
> >  		</fileSet>
> >
> > Modified:
> > incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
> > URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/ma
> >in/release/lib/WHICH_JARS?view=diff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
> > (original) +++
> > incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS Sun
> > Apr 22 22:56:43 2007 @@ -47,6 +47,11 @@
> >  - stax-utils.jar
> >
> >  For WS-Security support:
> > +- bcprov-jdk14.jar
> >  - wss4j.jar
> >  - xalan.jar
> > -- xmlsec.jar
> > \ No newline at end of file
> > +- xmlsec.jar
> > +
> > +For HTTP Binding support:
> > +- jra.jar
> > +- jettison.jar (Needed for JSON services only)
> >
> > Added:
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/ma
> >in/release/samples/spring_http/build.xml?view=auto&rev=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml (added) +++
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml Sun Apr 22 22:56:43 2007 @@ -0,0 +1,38 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +<!--
> > +  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.
> > +-->
> > +<project name="Spring HTTP Servlet demo" default="build"
> > basedir="."> +
> > +
> > +	<import file="../common_build.xml"/>
> > +
> > +    <target name="client" description="run demo client"
> > depends="build"> +        <property name="param" value=""/>
> > +        <cxfrun classname="demo.spring.client.Client" />
> > +    </target>
> > +
> > +    <target name="server" description="run demo server"
> > depends="build"> +        <cxfrun
> > classname="demo.spring.servlet.Server"/>
> > +    </target>
> > +
> > +    <property name="cxf.war.file.name" value="spring_http"/>
> > +      <target name="war" depends="build">
> > +	  <cxfwar filename="${cxf.war.file.name}.war"/>
> > +    </target>
> > +</project>
> >
> > Propchange:
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml
> > --------------------------------------------------------------------
> >---------- svn:eol-style = native
> >
> > Propchange:
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml
> > --------------------------------------------------------------------
> >---------- svn:executable = *
> >
> > Propchange:
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml
> > --------------------------------------------------------------------
> >---------- svn:keywords = Rev Date
> >
> > Propchange:
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/build.xml
> > --------------------------------------------------------------------
> >---------- svn:mime-type = text/xml
> >
> > Modified:
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/demo/spring/servlet/Server.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/ma
> >in/release/samples/spring_http/src/demo/spring/servlet/Server.java?vi
> >ew=diff&rev=531341&r1=531063&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/demo/spring/servlet/Server.java (original) +++
> > incubator/cxf/trunk/distribution/src/main/release/samples/spring_htt
> >p/src/demo/spring/servlet/Server.java Sun Apr 22 22:56:43 2007 @@
> > -46,7 +46,7 @@
> >          WebAppContext webappcontext = new WebAppContext();
> >          webappcontext.setContextPath("/");
> >
> > -        webappcontext.setWar("src/webapp");
> > +        webappcontext.setWar("webapp");
> >
> >          HandlerCollection handlers = new HandlerCollection();
> >          handlers.setHandlers(new Handler[] {webappcontext, new
> > DefaultHandler()});
> >
> > Modified:
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/CXFServlet.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/
> >src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?view=d
> >iff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/CXFServlet.java (original) +++
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/CXFServlet.java Sun Apr 22 22:56:43 2007 @@ -78,9
> > +78,6 @@
> >      public void init(ServletConfig servletConfig) throws
> > ServletException { super.init(servletConfig);
> >
> > -        BusFactory.setDefaultBus(null);
> > -        BusFactory.setThreadDefaultBus(null);
> > -
> >          String busid = servletConfig.getInitParameter("bus.id");
> >          if (null != busid) {
> >              WeakReference<Bus> ref = BUS_MAP.get(busid);
> > @@ -101,13 +98,11 @@
> >          if (null != busid) {
> >              BUS_MAP.put(busid, new WeakReference<Bus>(bus));
> >          }
> > -        BusFactory.setDefaultBus(null);
> > -        BusFactory.setThreadDefaultBus(null);
> >      }
> >
> >      private void loadBusNoConfig(ServletConfig servletConfig)
> > throws ServletException { if (bus == null) {
> > -            bus = BusFactory.getDefaultBus();
> > +            bus = BusFactory.newInstance().createBus();
> >          }
> >          ResourceManager resourceManager =
> > bus.getExtension(ResourceManager.class);
> > resourceManager.addResourceResolver(new
> > ServletContextResourceResolver(
> >
> > Modified:
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletController.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/
> >src/main/java/org/apache/cxf/transport/servlet/ServletController.java
> >?view=diff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletController.java (original) +++
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletController.java Sun Apr 22 22:56:43 2007 @@
> > -22,7 +22,6 @@
> >  import java.io.InputStream;
> >  import java.io.OutputStream;
> >  import java.util.Collection;
> > -import java.util.Set;
> >  import java.util.logging.Level;
> >  import java.util.logging.Logger;
> >
> > @@ -46,32 +45,11 @@
> >
> >      private ServletTransportFactory transport;
> >      private CXFServlet cxfServlet;
> > -    private String lastBase = "";
> >
> >      public ServletController(ServletTransportFactory df, CXFServlet
> > servlet) { this.transport = df;
> >          this.cxfServlet = servlet;
> >      }
> > -
> > -    private synchronized void updateDests(HttpServletRequest
> > request) { -        String pathInfo = request.getPathInfo() == null
> > ? "" : request.getPathInfo(); -        String base =
> > request.getRequestURL().toString();
> > -        base = base.substring(0, base.length() -
> > pathInfo.length()); -
> > -        if (base.equals(lastBase)) {
> > -            return;
> > -        }
> > -        Set<String> paths = transport.getDestinationsPaths();
> > -        for (String path : paths) {
> > -            ServletDestination d2 =
> > transport.getDestinationForPath(path); -            String ad =
> > d2.getEndpointInfo().getAddress(); -            if (ad.equals(path)
> > -                || ad.equals(lastBase + path)) {
> > -                d2.getEndpointInfo().setAddress(base + path);
> > -            }
> > -        }
> > -        lastBase = base;
> > -    }
> >
> >      public void invoke(HttpServletRequest request,
> > HttpServletResponse res) throws ServletException { try {
> > @@ -82,7 +60,6 @@
> >              ServletDestination d =
> > (ServletDestination)transport.getDestination(ei);
> >
> >              if (d.getMessageObserver() == null) {
> > -                updateDests(request);
> >                  if (request.getRequestURI().endsWith("services")
> >
> >                      || request.getRequestURI().endsWith("services/"
> >                      ||) StringUtils.isEmpty(request.getPathInfo())
> >
> > @@ -93,7 +70,6 @@
> >                      generateNotFound(request, res);
> >                  }
> >              } else {
> > -                updateDests(request);
> >                  ei = d.getEndpointInfo();
> >                  Bus bus = cxfServlet.getBus();
> >                  if (null != request.getQueryString()
> > @@ -133,14 +109,20 @@
> >          response.setContentType("text/html");
> >          response.getWriter().write("<html><body>");
> >
> > -        String reqPerfix = request.getRequestURL().toString();
> > -        String pathInfo = request.getPathInfo() == null ? "" :
> > request.getPathInfo(); -        reqPerfix = reqPerfix.substring(0,
> > reqPerfix.length() - pathInfo.length()); +        String reqPerfix =
> > getBaseURL(request);
> >
> >          if (destinations.size() > 0) {
> >              for (ServletDestination sd : destinations) {
> >                  if (null != sd.getEndpointInfo().getName()) {
> > -                    String address =
> > sd.getEndpointInfo().getAddress(); +                   
> > StringBuilder sb = new StringBuilder(); +                   
> > sb.append(reqPerfix);
> > +                    String path = sd.getAddressPath();
> > +                    if (reqPerfix.endsWith("/")) {
> > +                        path = path.substring(1);
> > +                    }
> > +                    sb.append(path);
> > +
> > +                    String address = sb.toString();
> >                      response.getWriter().write("<p> <a href=\"" +
> > address + "?wsdl\">");
> > response.getWriter().write(sd.getEndpointInfo().getName() + "</a>
> > </p>"); }
> > @@ -149,6 +131,13 @@
> >              response.getWriter().write("No service was found.");
> >          }
> >          response.getWriter().write("</body></html>");
> > +    }
> > +
> > +    private String getBaseURL(HttpServletRequest request) {
> > +        String reqPerfix = request.getRequestURL().toString();
> > +        String pathInfo = request.getPathInfo() == null ? "" :
> > request.getPathInfo(); +        reqPerfix = reqPerfix.substring(0,
> > reqPerfix.length() - pathInfo.length()); +        return reqPerfix;
> >      }
> >
> >      protected void generateNotFound(HttpServletRequest request,
> > HttpServletResponse res) throws IOException {
> >
> > Modified:
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletDestination.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/
> >src/main/java/org/apache/cxf/transport/servlet/ServletDestination.jav
> >a?view=diff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletDestination.java (original) +++
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletDestination.java Sun Apr 22 22:56:43 2007 @@
> > -101,7 +101,20 @@
> >              }
> >          }
> >      }
> > -
> > +
> > +    public String getAddressPath() {
> > +        String path = endpointInfo.getAddress();
> > +        String lh = "http://localhost/";
> > +        String lhs = "https://localhost/";
> > +
> > +        if (path.startsWith(lh)) {
> > +            path = "/" + path.substring(lh.length());
> > +        } else if (path.startsWith(lhs)) {
> > +            path = "/" + path.substring(lhs.length());
> > +        }
> > +        return path;
> > +    }
> > +
> >      public MessageObserver getMessageObserver() {
> >          return this.incomingObserver;
> >      }
> >
> > Modified:
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletTransportFactory.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/
> >src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactor
> >y.java?view=diff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletTransportFactory.java (original) +++
> > incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/
> >transport/servlet/ServletTransportFactory.java Sun Apr 22 22:56:43
> > 2007 @@ -60,16 +60,28 @@
> >
> >      public Destination getDestination(EndpointInfo endpointInfo)
> >          throws IOException {
> > -        ServletDestination d =
> > destinations.get(endpointInfo.getAddress()); +       
> > ServletDestination d =
> > getDestinationForPath(endpointInfo.getAddress()); if (d == null) {
> >              d = new ServletDestination(bus, null, endpointInfo);
> > -            destinations.put(endpointInfo.getAddress(), d);
> > +           
> > destinations.put(getTrimmedPath(endpointInfo.getAddress()), d); }
> >          return d;
> >      }
> >
> >      public ServletDestination getDestinationForPath(String path) {
> > -        return destinations.get(path);
> > +        return destinations.get(getTrimmedPath(path));
> > +    }
> > +
> > +    private String getTrimmedPath(String path) {
> > +        String lh = "http://localhost/";
> > +        String lhs = "https://localhost/";
> > +
> > +        if (path.startsWith(lh)) {
> > +            path = "/" + path.substring(lh.length());
> > +        } else if (path.startsWith(lhs)) {
> > +            path = "/" + path.substring(lhs.length());
> > +        }
> > +        return path;
> >      }
> >
> >      public Collection<ServletDestination> getDestinations() {
> >
> > Modified:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/AbstractServletTest.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> >ava/org/apache/cxf/systest/servlet/AbstractServletTest.java?view=diff
> >&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/AbstractServletTest.java (original) +++
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/AbstractServletTest.java Sun Apr 22 22:56:43 2007 @@ -19,10
> > +19,7 @@
> >  package org.apache.cxf.systest.servlet;
> >
> >  import java.io.IOException;
> > -import java.lang.ref.WeakReference;
> > -import java.lang.reflect.Field;
> >  import java.net.MalformedURLException;
> > -import java.util.Map;
> >
> >  import org.xml.sax.SAXException;
> >
> > @@ -33,10 +30,7 @@
> >  import com.meterware.servletunit.ServletRunner;
> >  import com.meterware.servletunit.ServletUnitClient;
> >
> > -import org.apache.cxf.Bus;
> > -import org.apache.cxf.helpers.CastUtils;
> >  import org.apache.cxf.test.AbstractCXFTest;
> > -import org.apache.cxf.transport.servlet.CXFServlet;
> >  import org.junit.Before;
> >
> >  public abstract class AbstractServletTest extends AbstractCXFTest {
> > @@ -52,13 +46,6 @@
> >          } catch (HttpNotFoundException e) {
> >              // ignore, we just want to boot up the servlet
> >          }
> > -
> > -        Field f = CXFServlet.class.getDeclaredField("BUS_MAP");
> > -        f.setAccessible(true);
> > -        Map<String, WeakReference<Bus>> obj =
> > CastUtils.cast((Map<?, ?>)f.get(null)); -        if
> > (obj.containsKey("servlet.systest.bus.id")) {
> > -            bus = obj.get("servlet.systest.bus.id").get();
> > -        }
> >
> >          HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
> >      }
> >
> > Modified:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/CXFServletTest.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> >ava/org/apache/cxf/systest/servlet/CXFServletTest.java?view=diff&rev=
> >531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/CXFServletTest.java (original) +++
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/CXFServletTest.java Sun Apr 22 22:56:43 2007 @@ -29,6 +29,8 @@
> >  import com.meterware.httpunit.WebResponse;
> >  import com.meterware.servletunit.ServletUnitClient;
> >
> > +import org.apache.cxf.Bus;
> > +import org.apache.cxf.BusException;
> >  import org.apache.cxf.helpers.DOMUtils;
> >  import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
> >  import org.apache.cxf.service.invoker.BeanInvoker;
> > @@ -38,13 +40,18 @@
> >
> >  public class CXFServletTest extends AbstractServletTest {
> >
> > +    @Override
> > +    protected Bus createBus() throws BusException {
> > +        return null;
> > +    }
> > +
> >      // Create the JaxWsService with the JaxWsServerFactoryBean
> >      protected void setupJaxwsService() {
> >          JaxWsServerFactoryBean svr = new JaxWsServerFactoryBean();
> >          URL resource =
> > getClass().getResource("/wsdl/hello_world.wsdl");
> > assertNotNull(resource);
> >          svr.getServiceFactory().setWsdlURL(resource.toString());
> > -        svr.setBus(getBus());
> > +//        svr.setBus(getBus());
> >          svr.setServiceClass(GreeterImpl.class);
> >          svr.setAddress("http://localhost/services/Greeter");
> >          GreeterImpl greeter = new GreeterImpl();
> >
> > Modified:
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/ExternalServicesServletTest.java URL:
> > http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/j
> >ava/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java?v
> >iew=diff&rev=531341&r1=531340&r2=531341
> > ====================================================================
> >========== ---
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/ExternalServicesServletTest.java (original) +++
> > incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/se
> >rvlet/ExternalServicesServletTest.java Sun Apr 22 22:56:43 2007 @@
> > -24,11 +24,18 @@
> >  import com.meterware.httpunit.WebRequest;
> >  import com.meterware.httpunit.WebResponse;
> >
> > +import org.apache.cxf.Bus;
> > +import org.apache.cxf.BusException;
> >  import org.apache.cxf.helpers.DOMUtils;
> >  import org.junit.Test;
> >
> >  public class ExternalServicesServletTest extends
> > AbstractServletTest {
> >
> > +    @Override
> > +    protected Bus createBus() throws BusException {
> > +        return null;
> > +    }
> > +
> >      @Override
> >      protected String getConfiguration() {
> >          return "/org/apache/cxf/systest/servlet/web-external.xml";

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: svn commit: r531341 - in /incubator/cxf/trunk: distribution/src/main/assembly/ distribution/src/main/release/lib/ distribution/src/main/release/samples/spring_http/ distribution/src/main/release/samples/spring_http/src/demo/ distribution/src/main/relea...

Posted by James Mao <ja...@iona.com>.
Hi Dan,

After this fix, i got:

client-servlet:
     [java] http://localhost:8080/helloworld/services/hello_world?wsdl
     [java] Invoking sayHi...
     [java] Exception in thread "main" javax.xml.ws.WebServiceException: 
org.apa
che.cxf.interceptor.Fault: Could not send Message.
     [java]     at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:134)
     [java]     at $Proxy34.sayHi(Unknown Source)
     [java]     at demo.hw.client.Client.main(Client.java:60)
     [java] Caused by: org.apache.cxf.interceptor.Fault: Could not send 
Message.

     [java]     at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMes
sage(MessageSenderInterceptor.java:47)
     [java]     at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
nterceptorChain.java:148)
     [java]     at 
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:215
)
     [java]     at 
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
va:73)
     [java]     at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:122)
     [java]     ... 2 more
     [java] Caused by: java.net.MalformedURLException: no protocol: 
/hello_world

     [java]     at java.net.URL.<init>(URL.java:567)
     [java]     at java.net.URL.<init>(URL.java:464)
     [java]     at java.net.URL.<init>(URL.java:413)
     [java]     at 
org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPCondui
t.java:611)
     [java]     at 
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit
.java:440)
     [java]     at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMes
sage(MessageSenderInterceptor.java:45)
     [java]     ... 6 more
     [java] Java Result: 1

The previous problem is just the URL problems, to fix the problem, what 
we need is modify the cxf-servlet.xml
change the jaxws:address from "/services/helloworld" to "/helloworld"

But now seems the whole demo is broken.

James.


> Author: dandiep
> Date: Sun Apr 22 22:56:43 2007
> New Revision: 531341
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=531341
> Log:
> o Change the servlet transport to look up services only by their
>   path. This means we don't have to put the context name in the 
>   address now, which means the samples will work correctly.
> o Allow CXFServlet to set the defaultbus. If you don't do this, it
>   breaks some Spring use cases. I also changed it so we ALWAYS create
>   a Bus (unless the bus id was specified). This should prevent
>   conflicts across servlet instances, which seems to be what the 
>   previous code was trying to prevent.
> o Add missing build.xml for spring_http sample and rework its directory
>   structure to be like the other samples.
>
> Added:
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml   (with props)
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/
>       - copied from r531063, incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/webapp/
>       - copied from r531063, incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/webapp/
> Removed:
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/webapp/
> Modified:
>     incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
>     incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
>
> Modified: incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/assembly/bin.xml?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/assembly/bin.xml (original)
> +++ incubator/cxf/trunk/distribution/src/main/assembly/bin.xml Sun Apr 22 22:56:43 2007
> @@ -35,6 +35,7 @@
>  				<include>LICENSE</include>
>  				<include>licenses/*.*</include>
>  				<include>modules/*</include>
> +				<include>lib/*</include>
>  				<include>README</include>
>  			</includes>
>  		</fileSet>
>
> Modified: incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS (original)
> +++ incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS Sun Apr 22 22:56:43 2007
> @@ -47,6 +47,11 @@
>  - stax-utils.jar
>  
>  For WS-Security support:
> +- bcprov-jdk14.jar
>  - wss4j.jar
>  - xalan.jar
> -- xmlsec.jar
> \ No newline at end of file
> +- xmlsec.jar
> +
> +For HTTP Binding support:
> +- jra.jar
> +- jettison.jar (Needed for JSON services only)
>
> Added: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml?view=auto&rev=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml (added)
> +++ incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml Sun Apr 22 22:56:43 2007
> @@ -0,0 +1,38 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +  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.
> +-->
> +<project name="Spring HTTP Servlet demo" default="build" basedir=".">
> +
> +
> +	<import file="../common_build.xml"/>        
> +
> +    <target name="client" description="run demo client" depends="build">
> +        <property name="param" value=""/>
> +        <cxfrun classname="demo.spring.client.Client" />
> +    </target> 
> +        
> +    <target name="server" description="run demo server" depends="build">
> +        <cxfrun classname="demo.spring.servlet.Server"/>
> +    </target>
> +
> +    <property name="cxf.war.file.name" value="spring_http"/>
> +      <target name="war" depends="build">
> +	  <cxfwar filename="${cxf.war.file.name}.war"/>
> +    </target>
> +</project>
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:executable = *
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:keywords = Rev Date
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:mime-type = text/xml
>
> Modified: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java?view=diff&rev=531341&r1=531063&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java (original)
> +++ incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java Sun Apr 22 22:56:43 2007
> @@ -46,7 +46,7 @@
>          WebAppContext webappcontext = new WebAppContext();
>          webappcontext.setContextPath("/");
>  
> -        webappcontext.setWar("src/webapp");
> +        webappcontext.setWar("webapp");
>  
>          HandlerCollection handlers = new HandlerCollection();
>          handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java Sun Apr 22 22:56:43 2007
> @@ -78,9 +78,6 @@
>      public void init(ServletConfig servletConfig) throws ServletException {
>          super.init(servletConfig);
>  
> -        BusFactory.setDefaultBus(null);
> -        BusFactory.setThreadDefaultBus(null);
> -        
>          String busid = servletConfig.getInitParameter("bus.id");
>          if (null != busid) {
>              WeakReference<Bus> ref = BUS_MAP.get(busid);
> @@ -101,13 +98,11 @@
>          if (null != busid) {
>              BUS_MAP.put(busid, new WeakReference<Bus>(bus));
>          }
> -        BusFactory.setDefaultBus(null);
> -        BusFactory.setThreadDefaultBus(null);
>      }
>      
>      private void loadBusNoConfig(ServletConfig servletConfig) throws ServletException {
>          if (bus == null) {
> -            bus = BusFactory.getDefaultBus();
> +            bus = BusFactory.newInstance().createBus();
>          }
>          ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
>          resourceManager.addResourceResolver(new ServletContextResourceResolver(
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Sun Apr 22 22:56:43 2007
> @@ -22,7 +22,6 @@
>  import java.io.InputStream;
>  import java.io.OutputStream;
>  import java.util.Collection;
> -import java.util.Set;
>  import java.util.logging.Level;
>  import java.util.logging.Logger;
>  
> @@ -46,32 +45,11 @@
>  
>      private ServletTransportFactory transport;
>      private CXFServlet cxfServlet;
> -    private String lastBase = "";
>   
>      public ServletController(ServletTransportFactory df, CXFServlet servlet) {
>          this.transport = df;
>          this.cxfServlet = servlet;
>      }
> -    
> -    private synchronized void updateDests(HttpServletRequest request) {
> -        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
> -        String base = request.getRequestURL().toString();
> -        base = base.substring(0, base.length() - pathInfo.length());
> -        
> -        if (base.equals(lastBase)) {
> -            return;
> -        }
> -        Set<String> paths = transport.getDestinationsPaths();
> -        for (String path : paths) {
> -            ServletDestination d2 = transport.getDestinationForPath(path);
> -            String ad = d2.getEndpointInfo().getAddress();
> -            if (ad.equals(path)
> -                || ad.equals(lastBase + path)) {
> -                d2.getEndpointInfo().setAddress(base + path);
> -            }
> -        }
> -        lastBase = base;
> -    }
>  
>      public void invoke(HttpServletRequest request, HttpServletResponse res) throws ServletException {
>          try {
> @@ -82,7 +60,6 @@
>              ServletDestination d = (ServletDestination)transport.getDestination(ei);
>  
>              if (d.getMessageObserver() == null) {
> -                updateDests(request);
>                  if (request.getRequestURI().endsWith("services")
>                      || request.getRequestURI().endsWith("services/")
>                      || StringUtils.isEmpty(request.getPathInfo())
> @@ -93,7 +70,6 @@
>                      generateNotFound(request, res);
>                  }
>              } else {
> -                updateDests(request);
>                  ei = d.getEndpointInfo();
>                  Bus bus = cxfServlet.getBus();
>                  if (null != request.getQueryString() 
> @@ -133,14 +109,20 @@
>          response.setContentType("text/html");        
>          response.getWriter().write("<html><body>");
>          
> -        String reqPerfix = request.getRequestURL().toString();
> -        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
> -        reqPerfix = reqPerfix.substring(0, reqPerfix.length() - pathInfo.length());
> +        String reqPerfix = getBaseURL(request);
>          
>          if (destinations.size() > 0) {  
>              for (ServletDestination sd : destinations) {
>                  if (null != sd.getEndpointInfo().getName()) {
> -                    String address = sd.getEndpointInfo().getAddress();
> +                    StringBuilder sb = new StringBuilder();
> +                    sb.append(reqPerfix);
> +                    String path = sd.getAddressPath();
> +                    if (reqPerfix.endsWith("/")) {
> +                        path = path.substring(1);
> +                    }
> +                    sb.append(path);
> +                    
> +                    String address = sb.toString();
>                      response.getWriter().write("<p> <a href=\"" + address + "?wsdl\">");
>                      response.getWriter().write(sd.getEndpointInfo().getName() + "</a> </p>");
>                  }    
> @@ -149,6 +131,13 @@
>              response.getWriter().write("No service was found.");
>          }
>          response.getWriter().write("</body></html>");
> +    }
> +
> +    private String getBaseURL(HttpServletRequest request) {
> +        String reqPerfix = request.getRequestURL().toString();
> +        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
> +        reqPerfix = reqPerfix.substring(0, reqPerfix.length() - pathInfo.length());
> +        return reqPerfix;
>      }
>  
>      protected void generateNotFound(HttpServletRequest request, HttpServletResponse res) throws IOException {
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Sun Apr 22 22:56:43 2007
> @@ -101,7 +101,20 @@
>              }
>          }        
>      }
> -   
> +
> +    public String getAddressPath() {
> +        String path = endpointInfo.getAddress();
> +        String lh = "http://localhost/";
> +        String lhs = "https://localhost/";
> +        
> +        if (path.startsWith(lh)) {
> +            path = "/" + path.substring(lh.length());
> +        } else if (path.startsWith(lhs)) {
> +            path = "/" + path.substring(lhs.length());
> +        }
> +        return path;
> +    }
> +    
>      public MessageObserver getMessageObserver() {
>          return this.incomingObserver;
>      }
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Sun Apr 22 22:56:43 2007
> @@ -60,16 +60,28 @@
>      
>      public Destination getDestination(EndpointInfo endpointInfo)
>          throws IOException {
> -        ServletDestination d = destinations.get(endpointInfo.getAddress());
> +        ServletDestination d = getDestinationForPath(endpointInfo.getAddress());
>          if (d == null) { 
>              d = new ServletDestination(bus, null, endpointInfo);
> -            destinations.put(endpointInfo.getAddress(), d);
> +            destinations.put(getTrimmedPath(endpointInfo.getAddress()), d);
>          }
>          return d;
>      }
>      
>      public ServletDestination getDestinationForPath(String path) {
> -        return destinations.get(path);
> +        return destinations.get(getTrimmedPath(path));
> +    }
> +
> +    private String getTrimmedPath(String path) {
> +        String lh = "http://localhost/";
> +        String lhs = "https://localhost/";
> +        
> +        if (path.startsWith(lh)) {
> +            path = "/" + path.substring(lh.length());
> +        } else if (path.startsWith(lhs)) {
> +            path = "/" + path.substring(lhs.length());
> +        }
> +        return path;
>      }
>      
>      public Collection<ServletDestination> getDestinations() {
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java Sun Apr 22 22:56:43 2007
> @@ -19,10 +19,7 @@
>  package org.apache.cxf.systest.servlet;
>  
>  import java.io.IOException;
> -import java.lang.ref.WeakReference;
> -import java.lang.reflect.Field;
>  import java.net.MalformedURLException;
> -import java.util.Map;
>  
>  import org.xml.sax.SAXException;
>  
> @@ -33,10 +30,7 @@
>  import com.meterware.servletunit.ServletRunner;
>  import com.meterware.servletunit.ServletUnitClient;
>  
> -import org.apache.cxf.Bus;
> -import org.apache.cxf.helpers.CastUtils;
>  import org.apache.cxf.test.AbstractCXFTest;
> -import org.apache.cxf.transport.servlet.CXFServlet;
>  import org.junit.Before;
>  
>  public abstract class AbstractServletTest extends AbstractCXFTest {
> @@ -52,13 +46,6 @@
>          } catch (HttpNotFoundException e) {
>              // ignore, we just want to boot up the servlet
>          }   
> -        
> -        Field f = CXFServlet.class.getDeclaredField("BUS_MAP");
> -        f.setAccessible(true);
> -        Map<String, WeakReference<Bus>> obj = CastUtils.cast((Map<?, ?>)f.get(null));
> -        if (obj.containsKey("servlet.systest.bus.id")) {
> -            bus = obj.get("servlet.systest.bus.id").get();
> -        }
>          
>          HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);        
>      } 
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java Sun Apr 22 22:56:43 2007
> @@ -29,6 +29,8 @@
>  import com.meterware.httpunit.WebResponse;
>  import com.meterware.servletunit.ServletUnitClient;
>  
> +import org.apache.cxf.Bus;
> +import org.apache.cxf.BusException;
>  import org.apache.cxf.helpers.DOMUtils;
>  import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
>  import org.apache.cxf.service.invoker.BeanInvoker;
> @@ -38,13 +40,18 @@
>  
>  public class CXFServletTest extends AbstractServletTest {
>      
> +    @Override
> +    protected Bus createBus() throws BusException {
> +        return null;
> +    }
> +
>      // Create the JaxWsService with the JaxWsServerFactoryBean
>      protected void setupJaxwsService() {
>          JaxWsServerFactoryBean svr = new JaxWsServerFactoryBean();
>          URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
>          assertNotNull(resource);
>          svr.getServiceFactory().setWsdlURL(resource.toString());
> -        svr.setBus(getBus());
> +//        svr.setBus(getBus());
>          svr.setServiceClass(GreeterImpl.class);
>          svr.setAddress("http://localhost/services/Greeter");
>          GreeterImpl greeter = new GreeterImpl();
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java Sun Apr 22 22:56:43 2007
> @@ -24,11 +24,18 @@
>  import com.meterware.httpunit.WebRequest;
>  import com.meterware.httpunit.WebResponse;
>  
> +import org.apache.cxf.Bus;
> +import org.apache.cxf.BusException;
>  import org.apache.cxf.helpers.DOMUtils;
>  import org.junit.Test;
>  
>  public class ExternalServicesServletTest extends AbstractServletTest {
>      
> +    @Override
> +    protected Bus createBus() throws BusException {
> +        return null;
> +    }
> +
>      @Override
>      protected String getConfiguration() {
>          return "/org/apache/cxf/systest/servlet/web-external.xml";
>
>
>
>   


Re: svn commit: r531341 - in /incubator/cxf/trunk: distribution/src/main/assembly/ distribution/src/main/release/lib/ distribution/src/main/release/samples/spring_http/ distribution/src/main/release/samples/spring_http/src/demo/ distribution/src/main/relea...

Posted by James Mao <ja...@iona.com>.
Hi Dan,

After this fix, i got:

client-servlet:
     [java] http://localhost:8080/helloworld/services/hello_world?wsdl
     [java] Invoking sayHi...
     [java] Exception in thread "main" javax.xml.ws.WebServiceException: 
org.apa
che.cxf.interceptor.Fault: Could not send Message.
     [java]     at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:134)
     [java]     at $Proxy34.sayHi(Unknown Source)
     [java]     at demo.hw.client.Client.main(Client.java:60)
     [java] Caused by: org.apache.cxf.interceptor.Fault: Could not send 
Message.

     [java]     at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMes
sage(MessageSenderInterceptor.java:47)
     [java]     at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseI
nterceptorChain.java:148)
     [java]     at 
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:215
)
     [java]     at 
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.ja
va:73)
     [java]     at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy
.java:122)
     [java]     ... 2 more
     [java] Caused by: java.net.MalformedURLException: no protocol: 
/hello_world

     [java]     at java.net.URL.<init>(URL.java:567)
     [java]     at java.net.URL.<init>(URL.java:464)
     [java]     at java.net.URL.<init>(URL.java:413)
     [java]     at 
org.apache.cxf.transport.http.HTTPConduit.setupURL(HTTPCondui
t.java:611)
     [java]     at 
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit
.java:440)
     [java]     at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMes
sage(MessageSenderInterceptor.java:45)
     [java]     ... 6 more
     [java] Java Result: 1

The previous problem is just the URL problems, to fix the problem, what 
we need is modify the cxf-servlet.xml
change the jaxws:address from "/services/helloworld" to "/helloworld"

But now seems the whole demo is broken.

James.


> Author: dandiep
> Date: Sun Apr 22 22:56:43 2007
> New Revision: 531341
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=531341
> Log:
> o Change the servlet transport to look up services only by their
>   path. This means we don't have to put the context name in the 
>   address now, which means the samples will work correctly.
> o Allow CXFServlet to set the defaultbus. If you don't do this, it
>   breaks some Spring use cases. I also changed it so we ALWAYS create
>   a Bus (unless the bus id was specified). This should prevent
>   conflicts across servlet instances, which seems to be what the 
>   previous code was trying to prevent.
> o Add missing build.xml for spring_http sample and rework its directory
>   structure to be like the other samples.
>
> Added:
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml   (with props)
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/
>       - copied from r531063, incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/webapp/
>       - copied from r531063, incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/webapp/
> Removed:
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/webapp/
> Modified:
>     incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
>     incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
>     incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
>     incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
>     incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
>
> Modified: incubator/cxf/trunk/distribution/src/main/assembly/bin.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/assembly/bin.xml?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/assembly/bin.xml (original)
> +++ incubator/cxf/trunk/distribution/src/main/assembly/bin.xml Sun Apr 22 22:56:43 2007
> @@ -35,6 +35,7 @@
>  				<include>LICENSE</include>
>  				<include>licenses/*.*</include>
>  				<include>modules/*</include>
> +				<include>lib/*</include>
>  				<include>README</include>
>  			</includes>
>  		</fileSet>
>
> Modified: incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS (original)
> +++ incubator/cxf/trunk/distribution/src/main/release/lib/WHICH_JARS Sun Apr 22 22:56:43 2007
> @@ -47,6 +47,11 @@
>  - stax-utils.jar
>  
>  For WS-Security support:
> +- bcprov-jdk14.jar
>  - wss4j.jar
>  - xalan.jar
> -- xmlsec.jar
> \ No newline at end of file
> +- xmlsec.jar
> +
> +For HTTP Binding support:
> +- jra.jar
> +- jettison.jar (Needed for JSON services only)
>
> Added: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml?view=auto&rev=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml (added)
> +++ incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml Sun Apr 22 22:56:43 2007
> @@ -0,0 +1,38 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> +  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.
> +-->
> +<project name="Spring HTTP Servlet demo" default="build" basedir=".">
> +
> +
> +	<import file="../common_build.xml"/>        
> +
> +    <target name="client" description="run demo client" depends="build">
> +        <property name="param" value=""/>
> +        <cxfrun classname="demo.spring.client.Client" />
> +    </target> 
> +        
> +    <target name="server" description="run demo server" depends="build">
> +        <cxfrun classname="demo.spring.servlet.Server"/>
> +    </target>
> +
> +    <property name="cxf.war.file.name" value="spring_http"/>
> +      <target name="war" depends="build">
> +	  <cxfwar filename="${cxf.war.file.name}.war"/>
> +    </target>
> +</project>
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:executable = *
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:keywords = Rev Date
>
> Propchange: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/build.xml
> ------------------------------------------------------------------------------
>     svn:mime-type = text/xml
>
> Modified: incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java?view=diff&rev=531341&r1=531063&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java (original)
> +++ incubator/cxf/trunk/distribution/src/main/release/samples/spring_http/src/demo/spring/servlet/Server.java Sun Apr 22 22:56:43 2007
> @@ -46,7 +46,7 @@
>          WebAppContext webappcontext = new WebAppContext();
>          webappcontext.setContextPath("/");
>  
> -        webappcontext.setWar("src/webapp");
> +        webappcontext.setWar("webapp");
>  
>          HandlerCollection handlers = new HandlerCollection();
>          handlers.setHandlers(new Handler[] {webappcontext, new DefaultHandler()});
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFServlet.java Sun Apr 22 22:56:43 2007
> @@ -78,9 +78,6 @@
>      public void init(ServletConfig servletConfig) throws ServletException {
>          super.init(servletConfig);
>  
> -        BusFactory.setDefaultBus(null);
> -        BusFactory.setThreadDefaultBus(null);
> -        
>          String busid = servletConfig.getInitParameter("bus.id");
>          if (null != busid) {
>              WeakReference<Bus> ref = BUS_MAP.get(busid);
> @@ -101,13 +98,11 @@
>          if (null != busid) {
>              BUS_MAP.put(busid, new WeakReference<Bus>(bus));
>          }
> -        BusFactory.setDefaultBus(null);
> -        BusFactory.setThreadDefaultBus(null);
>      }
>      
>      private void loadBusNoConfig(ServletConfig servletConfig) throws ServletException {
>          if (bus == null) {
> -            bus = BusFactory.getDefaultBus();
> +            bus = BusFactory.newInstance().createBus();
>          }
>          ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
>          resourceManager.addResourceResolver(new ServletContextResourceResolver(
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletController.java Sun Apr 22 22:56:43 2007
> @@ -22,7 +22,6 @@
>  import java.io.InputStream;
>  import java.io.OutputStream;
>  import java.util.Collection;
> -import java.util.Set;
>  import java.util.logging.Level;
>  import java.util.logging.Logger;
>  
> @@ -46,32 +45,11 @@
>  
>      private ServletTransportFactory transport;
>      private CXFServlet cxfServlet;
> -    private String lastBase = "";
>   
>      public ServletController(ServletTransportFactory df, CXFServlet servlet) {
>          this.transport = df;
>          this.cxfServlet = servlet;
>      }
> -    
> -    private synchronized void updateDests(HttpServletRequest request) {
> -        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
> -        String base = request.getRequestURL().toString();
> -        base = base.substring(0, base.length() - pathInfo.length());
> -        
> -        if (base.equals(lastBase)) {
> -            return;
> -        }
> -        Set<String> paths = transport.getDestinationsPaths();
> -        for (String path : paths) {
> -            ServletDestination d2 = transport.getDestinationForPath(path);
> -            String ad = d2.getEndpointInfo().getAddress();
> -            if (ad.equals(path)
> -                || ad.equals(lastBase + path)) {
> -                d2.getEndpointInfo().setAddress(base + path);
> -            }
> -        }
> -        lastBase = base;
> -    }
>  
>      public void invoke(HttpServletRequest request, HttpServletResponse res) throws ServletException {
>          try {
> @@ -82,7 +60,6 @@
>              ServletDestination d = (ServletDestination)transport.getDestination(ei);
>  
>              if (d.getMessageObserver() == null) {
> -                updateDests(request);
>                  if (request.getRequestURI().endsWith("services")
>                      || request.getRequestURI().endsWith("services/")
>                      || StringUtils.isEmpty(request.getPathInfo())
> @@ -93,7 +70,6 @@
>                      generateNotFound(request, res);
>                  }
>              } else {
> -                updateDests(request);
>                  ei = d.getEndpointInfo();
>                  Bus bus = cxfServlet.getBus();
>                  if (null != request.getQueryString() 
> @@ -133,14 +109,20 @@
>          response.setContentType("text/html");        
>          response.getWriter().write("<html><body>");
>          
> -        String reqPerfix = request.getRequestURL().toString();
> -        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
> -        reqPerfix = reqPerfix.substring(0, reqPerfix.length() - pathInfo.length());
> +        String reqPerfix = getBaseURL(request);
>          
>          if (destinations.size() > 0) {  
>              for (ServletDestination sd : destinations) {
>                  if (null != sd.getEndpointInfo().getName()) {
> -                    String address = sd.getEndpointInfo().getAddress();
> +                    StringBuilder sb = new StringBuilder();
> +                    sb.append(reqPerfix);
> +                    String path = sd.getAddressPath();
> +                    if (reqPerfix.endsWith("/")) {
> +                        path = path.substring(1);
> +                    }
> +                    sb.append(path);
> +                    
> +                    String address = sb.toString();
>                      response.getWriter().write("<p> <a href=\"" + address + "?wsdl\">");
>                      response.getWriter().write(sd.getEndpointInfo().getName() + "</a> </p>");
>                  }    
> @@ -149,6 +131,13 @@
>              response.getWriter().write("No service was found.");
>          }
>          response.getWriter().write("</body></html>");
> +    }
> +
> +    private String getBaseURL(HttpServletRequest request) {
> +        String reqPerfix = request.getRequestURL().toString();
> +        String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
> +        reqPerfix = reqPerfix.substring(0, reqPerfix.length() - pathInfo.length());
> +        return reqPerfix;
>      }
>  
>      protected void generateNotFound(HttpServletRequest request, HttpServletResponse res) throws IOException {
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletDestination.java Sun Apr 22 22:56:43 2007
> @@ -101,7 +101,20 @@
>              }
>          }        
>      }
> -   
> +
> +    public String getAddressPath() {
> +        String path = endpointInfo.getAddress();
> +        String lh = "http://localhost/";
> +        String lhs = "https://localhost/";
> +        
> +        if (path.startsWith(lh)) {
> +            path = "/" + path.substring(lh.length());
> +        } else if (path.startsWith(lhs)) {
> +            path = "/" + path.substring(lhs.length());
> +        }
> +        return path;
> +    }
> +    
>      public MessageObserver getMessageObserver() {
>          return this.incomingObserver;
>      }
>
> Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java (original)
> +++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/ServletTransportFactory.java Sun Apr 22 22:56:43 2007
> @@ -60,16 +60,28 @@
>      
>      public Destination getDestination(EndpointInfo endpointInfo)
>          throws IOException {
> -        ServletDestination d = destinations.get(endpointInfo.getAddress());
> +        ServletDestination d = getDestinationForPath(endpointInfo.getAddress());
>          if (d == null) { 
>              d = new ServletDestination(bus, null, endpointInfo);
> -            destinations.put(endpointInfo.getAddress(), d);
> +            destinations.put(getTrimmedPath(endpointInfo.getAddress()), d);
>          }
>          return d;
>      }
>      
>      public ServletDestination getDestinationForPath(String path) {
> -        return destinations.get(path);
> +        return destinations.get(getTrimmedPath(path));
> +    }
> +
> +    private String getTrimmedPath(String path) {
> +        String lh = "http://localhost/";
> +        String lhs = "https://localhost/";
> +        
> +        if (path.startsWith(lh)) {
> +            path = "/" + path.substring(lh.length());
> +        } else if (path.startsWith(lhs)) {
> +            path = "/" + path.substring(lhs.length());
> +        }
> +        return path;
>      }
>      
>      public Collection<ServletDestination> getDestinations() {
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/AbstractServletTest.java Sun Apr 22 22:56:43 2007
> @@ -19,10 +19,7 @@
>  package org.apache.cxf.systest.servlet;
>  
>  import java.io.IOException;
> -import java.lang.ref.WeakReference;
> -import java.lang.reflect.Field;
>  import java.net.MalformedURLException;
> -import java.util.Map;
>  
>  import org.xml.sax.SAXException;
>  
> @@ -33,10 +30,7 @@
>  import com.meterware.servletunit.ServletRunner;
>  import com.meterware.servletunit.ServletUnitClient;
>  
> -import org.apache.cxf.Bus;
> -import org.apache.cxf.helpers.CastUtils;
>  import org.apache.cxf.test.AbstractCXFTest;
> -import org.apache.cxf.transport.servlet.CXFServlet;
>  import org.junit.Before;
>  
>  public abstract class AbstractServletTest extends AbstractCXFTest {
> @@ -52,13 +46,6 @@
>          } catch (HttpNotFoundException e) {
>              // ignore, we just want to boot up the servlet
>          }   
> -        
> -        Field f = CXFServlet.class.getDeclaredField("BUS_MAP");
> -        f.setAccessible(true);
> -        Map<String, WeakReference<Bus>> obj = CastUtils.cast((Map<?, ?>)f.get(null));
> -        if (obj.containsKey("servlet.systest.bus.id")) {
> -            bus = obj.get("servlet.systest.bus.id").get();
> -        }
>          
>          HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);        
>      } 
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java Sun Apr 22 22:56:43 2007
> @@ -29,6 +29,8 @@
>  import com.meterware.httpunit.WebResponse;
>  import com.meterware.servletunit.ServletUnitClient;
>  
> +import org.apache.cxf.Bus;
> +import org.apache.cxf.BusException;
>  import org.apache.cxf.helpers.DOMUtils;
>  import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
>  import org.apache.cxf.service.invoker.BeanInvoker;
> @@ -38,13 +40,18 @@
>  
>  public class CXFServletTest extends AbstractServletTest {
>      
> +    @Override
> +    protected Bus createBus() throws BusException {
> +        return null;
> +    }
> +
>      // Create the JaxWsService with the JaxWsServerFactoryBean
>      protected void setupJaxwsService() {
>          JaxWsServerFactoryBean svr = new JaxWsServerFactoryBean();
>          URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
>          assertNotNull(resource);
>          svr.getServiceFactory().setWsdlURL(resource.toString());
> -        svr.setBus(getBus());
> +//        svr.setBus(getBus());
>          svr.setServiceClass(GreeterImpl.class);
>          svr.setAddress("http://localhost/services/Greeter");
>          GreeterImpl greeter = new GreeterImpl();
>
> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
> URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java?view=diff&rev=531341&r1=531340&r2=531341
> ==============================================================================
> --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java (original)
> +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java Sun Apr 22 22:56:43 2007
> @@ -24,11 +24,18 @@
>  import com.meterware.httpunit.WebRequest;
>  import com.meterware.httpunit.WebResponse;
>  
> +import org.apache.cxf.Bus;
> +import org.apache.cxf.BusException;
>  import org.apache.cxf.helpers.DOMUtils;
>  import org.junit.Test;
>  
>  public class ExternalServicesServletTest extends AbstractServletTest {
>      
> +    @Override
> +    protected Bus createBus() throws BusException {
> +        return null;
> +    }
> +
>      @Override
>      protected String getConfiguration() {
>          return "/org/apache/cxf/systest/servlet/web-external.xml";
>
>
>
>