cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1073524 - in /cxf/trunk: api/src/main/java/org/apache/cxf/message/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/core/src/main/java/org/apache/cxf/transport/http/ rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport...
Date Tue, 22 Feb 2011 21:53:14 GMT
Author: dkulp
Date: Tue Feb 22 21:53:13 2011
New Revision: 1073524

URL: http://svn.apache.org/viewvc?rev=1073524&view=rev
Log:
Change the WSDL query stuff into an interceptor that only appears on the
WSDL based endpoints chain.   This will make it easier to configure as
well as make it easier to change the behavior a bit.   Also reduces some
soap/wsdl specific stuff from core.

Added:
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java   (contents, props changed)
      - copied, changed from r1073523, cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java   (contents, props changed)
      - copied, changed from r1073523, cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryException.java
Removed:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryMessages.properties
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryException.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
    cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
    cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans_no_autoRewriteSoapAddress.xml
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Tue Feb 22 21:53:13 2011
@@ -72,6 +72,7 @@ public interface Message extends StringM
     
     String HTTP_REQUEST_METHOD = "org.apache.cxf.request.method";
     String REQUEST_URI = "org.apache.cxf.request.uri";
+    String REQUEST_URL = "org.apache.cxf.request.url";
     
     String PROTOCOL_HEADERS = Message.class.getName() + ".PROTOCOL_HEADERS";
     String RESPONSE_CODE = Message.class.getName() + ".RESPONSE_CODE";

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Tue Feb 22 21:53:13 2011
@@ -876,7 +876,7 @@ public class SoapBindingFactory extends 
             newMO.getBindingInterceptors().add(new AttachmentInInterceptor());
             newMO.getBindingInterceptors().add(new StaxInInterceptor());
 
-            // This will not work if we one of the endpoints disables message
+            // This will not work if one of the endpoints disables message
             // processing. But, if you've disabled message processing, you
             // probably aren't going to use this feature.
             

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/QueryHandlerRegistryImpl.java Tue Feb 22 21:53:13 2011
@@ -63,10 +63,6 @@ public class QueryHandlerRegistryImpl im
         if (null != bus) {
             bus.setExtension(this, QueryHandlerRegistry.class);
             
-            WSDLQueryHandler wsdlQueryHandler = new WSDLQueryHandler();
-            wsdlQueryHandler.setBus(bus);
-            queryHandlers.add(wsdlQueryHandler);
-            
             ConfiguredBeanLocator c = bus.getExtension(ConfiguredBeanLocator.class);
             if (c != null) {
                 for (QueryHandler handler : c.getBeansOfType(QueryHandler.class)) {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/jaxws22/org/apache/cxf/transport/http_jaxws_spi/HttpServletRequestAdapter.java Tue Feb 22 21:53:13 2011
@@ -334,10 +334,14 @@ class HttpServletRequestAdapter implemen
         sb.append(exchange.getScheme());
         sb.append("://");
         InetSocketAddress la = exchange.getLocalAddress();
-        sb.append(la.getHostName());
-        if (la.getPort() > 0) {
-            sb.append(":");
-            sb.append(la.getPort());
+        if (la != null) {
+            sb.append(la.getHostName());
+            if (la.getPort() > 0) {
+                sb.append(":");
+                sb.append(la.getPort());
+            }
+        } else {
+            sb.append("localhost");
         }
         sb.append(exchange.getContextPath());
         sb.append(context.getPath());

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ConfiguredEndpointTest.java Tue Feb 22 21:53:13 2011
@@ -290,7 +290,7 @@ public class ConfiguredEndpointTest exte
         assertTrue("Unexpected value for property validating", 
                    Boolean.valueOf((String) ei.getProperties().get(Message.SCHEMA_VALIDATION_ENABLED)));
         List<Interceptor<? extends Message>> interceptors = endpoint.getInInterceptors();
-        assertEquals("Unexpected number of interceptors.", 4, interceptors.size());
+        assertEquals("Unexpected number of interceptors.", 5, interceptors.size());
         assertEquals("Unexpected interceptor id.", "endpoint-in", 
                      findTestInterceptor(interceptors).getId());
         interceptors = endpoint.getOutInterceptors();

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java Tue Feb 22 21:53:13 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.jaxws.spring;
 
-import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.List;
@@ -56,7 +55,6 @@ import org.apache.cxf.jaxws.JaxWsServerF
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.jaxws.spring.NamespaceHandler.SpringServerFactoryBean;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.transport.http.WSDLQueryHandler;
 import org.apache.hello_world_soap_http.Greeter;
 import org.junit.After;
 import org.junit.Test;
@@ -263,15 +261,6 @@ public class SpringBeansTest extends Ass
         sbc = (SoapBindingConfiguration) bc;
         assertEquals("rpc", sbc.getStyle());
 
-        WSDLQueryHandler handler = new WSDLQueryHandler((Bus)ctx.getBean("cxf"));
-        ByteArrayOutputStream bout = new ByteArrayOutputStream();
-        handler.writeResponse("http://localhost/test?wsdl", "/test",
-                              bean.create().getEndpoint().getEndpointInfo(),
-                              bout);
-        String wsdl = bout.toString();
-        assertTrue(wsdl.contains("name=\"stringArray\""));
-        assertTrue(wsdl.contains("name=\"stringArray\""));
-
         bean = (JaxWsServerFactoryBean) ctx.getBean("simple");
         assertNotNull(bean);
 

Modified: cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/jaxws22/org/apache/cxf/transport/http_jaxws_spi/JAXWSHttpSpiDestinationTest.java Tue Feb 22 21:53:13 2011
@@ -33,7 +33,6 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.http.DestinationRegistryImpl;
-import org.apache.cxf.transport.http.WSDLQueryHandler;
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.easymock.classextension.EasyMock;
@@ -103,30 +102,7 @@ public class JAXWSHttpSpiDestinationTest
         control.verify();
     }
     
-    @Test
-    public void testWSDLQuery() throws Exception {
-        WSDLQueryHandler wqh = control.createMock(WSDLQueryHandler.class);
-        String pathInfo = null;
-        String addr = ADDRESS + "?wsdl";
-        expect(wqh.isRecognizedQuery(addr, pathInfo, endpoint, false)).andReturn(true);
-        wqh.writeResponse(eq(addr), eq(pathInfo), eq(endpoint), isA(OutputStream.class));
-        EasyMock.expectLastCall();
-        QueryHandlerRegistry qhr = control.createMock(QueryHandlerRegistry.class);
-        expect(qhr.getHandlers()).andReturn(Collections.singletonList((QueryHandler)wqh));
-        expect(bus.getExtension(QueryHandlerRegistry.class)).andReturn(qhr);
-        HttpExchange exchange = setUpExchangeForWSDLQuery(pathInfo);
-        control.replay();
-
-        JAXWSHttpSpiDestination destination = 
-            new JAXWSHttpSpiDestination(bus, new DestinationRegistryImpl(), endpoint);
-        destination.setMessageObserver(observer);
-
-        destination.doService(new HttpServletRequestAdapter(exchange),
-                              new HttpServletResponseAdapter(exchange));
 
-        control.verify();
-    }
-    
     private HttpExchange setUpExchange() throws Exception {
         HttpExchange exchange = control.createMock(HttpExchange.class);
         expect(exchange.getHttpContext()).andReturn(context).anyTimes();
@@ -146,23 +122,5 @@ public class JAXWSHttpSpiDestinationTest
         return exchange;
     }
     
-    private HttpExchange setUpExchangeForWSDLQuery(String pathInfo) throws Exception {
-        HttpExchange exchange = control.createMock(HttpExchange.class);
-        expect(exchange.getHttpContext()).andReturn(context).anyTimes();
-        expect(exchange.getQueryString()).andReturn("wsdl").anyTimes();
-        expect(exchange.getPathInfo()).andReturn(pathInfo);
-        expect(context.getPath()).andReturn(PATH);
-        expect(exchange.getContextPath()).andReturn(CONTEXT_PATH);
-        expect(exchange.getScheme()).andReturn("http");
-        expect(exchange.getLocalAddress()).andReturn(new InetSocketAddress("localhost", 80));
-        Map<String, List<String>> resHeaders = new HashMap<String, List<String>>();
-        expect(exchange.getResponseHeaders()).andReturn(resHeaders).anyTimes();
-        OutputStream responseBody = control.createMock(OutputStream.class);
-        responseBody.flush();
-        EasyMock.expectLastCall();
-        expect(exchange.getResponseBody()).andReturn(responseBody).anyTimes();
-        
-        return exchange;
-    }
     
 }

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java Tue Feb 22 21:53:13 2011
@@ -180,6 +180,7 @@ public abstract class AbstractWSDLBasedE
         
         if (getInInterceptors() != null) {
             ep.getInInterceptors().addAll(getInInterceptors());
+            ep.getInInterceptors().add(WSDLGetInterceptor.INSTANCE);
         }
         if (getOutInterceptors() != null) {
             ep.getOutInterceptors().addAll(getOutInterceptors());

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/Messages.properties Tue Feb 22 21:53:13 2011
@@ -19,4 +19,6 @@
 #
 #
 COULD.NOT.RESOLVE.BINDING=Could not resolve a binding for {0}
-
+COULD_NOT_PROVIDE_WSDL = Exception occurred while trying to process {0}
+WSDL_NOT_FOUND = Could not find wsdl {0}
+SCHEMA_NOT_FOUND = Could not find xsd {0}

Copied: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java (from r1073523, cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java?p2=cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java&p1=cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java&r1=1073523&r2=1073524&rev=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java Tue Feb 22 21:53:13 2011
@@ -17,8 +17,9 @@
  * under the License.
  */
 
-package org.apache.cxf.transport.http;
+package org.apache.cxf.frontend;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
@@ -52,75 +53,107 @@ import org.xml.sax.InputSource;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.catalog.OASISCatalogManager;
-import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.message.MessageUtils;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.cxf.transports.http.StemMatchingQueryHandler;
+import org.apache.cxf.transport.Conduit;
+import org.apache.cxf.transport.http.UrlUtilities;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.ResourceManagerWSDLLocator;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 
-
-@NoJSR250Annotations
-public class WSDLQueryHandler implements StemMatchingQueryHandler {
-    private static final Logger LOG = LogUtils.getL7dLogger(WSDLQueryHandler.class, "QueryMessages");
-    private Bus bus;
+/**
+ * 
+ */
+public class WSDLGetInterceptor extends AbstractPhaseInterceptor<Message> {
+    public static final WSDLGetInterceptor INSTANCE = new WSDLGetInterceptor();
     
-    public WSDLQueryHandler() {
-    }
-    public WSDLQueryHandler(Bus b) {
-        bus = b;
-    }
+    public static final String AUTO_REWRITE_ADDRESS = "autoRewriteSoapAddress";
+    public static final String PUBLISHED_ENDPOINT_URL = "publishedEndpointUrl";
     
-    public String getResponseContentType(String baseUri, String ctx) {
-        if (baseUri.toLowerCase().contains("?wsdl")
-            || baseUri.toLowerCase().contains("?xsd=")) {
-            return "text/xml";
-        }
-        return null;
+    private static final String WSDLS_KEY = WSDLGetInterceptor.class.getName() + ".WSDLs";
+    private static final String SCHEMAS_KEY = WSDLGetInterceptor.class.getName() + ".Schemas";
+    
+    private static final Logger LOG = LogUtils.getL7dLogger(WSDLGetInterceptor.class);
+    
+    public WSDLGetInterceptor() {
+        super(Phase.READ);
     }
 
-    public boolean isRecognizedQuery(String baseUri, String ctx, 
-                                     EndpointInfo endpointInfo, boolean contextMatchExact) {
-        if (baseUri != null 
-            && (baseUri.contains("?") 
-                && (baseUri.toLowerCase().contains("wsdl")
-                || baseUri.toLowerCase().contains("xsd=")))) {
-            
-            int idx = baseUri.indexOf("?");
-            Map<String, String> map = UrlUtilities.parseQueryString(baseUri.substring(idx + 1));
-            if (map.containsKey("wsdl")
-                || map.containsKey("xsd")) {
-                if (contextMatchExact) {
-                    return endpointInfo.getAddress().contains(ctx);
-                } else {
-                    // contextMatchStrategy will be "stem"
-                    return endpointInfo.getAddress().
-                                contains(UrlUtilities.getStem(baseUri.substring(0, idx)));
+    public void handleMessage(Message message) throws Fault {
+        String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
+        String query = (String)message.get(Message.QUERY_STRING);
+        if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
+            return;
+        }
+        String baseUri = (String)message.get(Message.REQUEST_URL);
+        String ctx = (String)message.get(Message.PATH_INFO);
+        
+        
+        //cannot have two wsdl's being written for the same endpoint at the same
+        //time as the addresses may get mixed up
+        synchronized (message.getExchange().getEndpoint()) {
+            Map<String, String> map = UrlUtilities.parseQueryString(query);
+            if (isRecognizedQuery(map, baseUri, ctx, 
+                                  message.getExchange().getEndpoint().getEndpointInfo())) {
+                
+                try {
+                    Conduit c = message.getExchange().getDestination().getBackChannel(message, null, null);
+                    Message mout = new MessageImpl();
+                    mout.setExchange(message.getExchange());
+                    message.getExchange().setOutMessage(mout);
+                    mout.put(Message.CONTENT_TYPE, "text/xml");
+                    c.prepare(mout);
+                    OutputStream os = mout.getContent(OutputStream.class);
+                    writeResponse(message,
+                                  baseUri,
+                                  map,
+                                  ctx,
+                                  message.getExchange().getEndpoint().getEndpointInfo(),
+                                  os);
+                    os.close();
+                    message.getInterceptorChain().abort();
+                } catch (IOException e) {
+                    throw new Fault(e);
+                } finally {
+                    message.getExchange().setOutMessage(null);
                 }
             }
         }
+    }
+
+    public boolean isRecognizedQuery(Map<String, String> map,
+                                     String baseUri,
+                                     String ctx, 
+                                     EndpointInfo endpointInfo) {
+        if (map.containsKey("wsdl")
+            || map.containsKey("xsd")) {
+            return true;
+        }
         return false;
     }
 
-    public void writeResponse(String baseUri, String ctxUri,
-                              EndpointInfo endpointInfo, OutputStream os) {
+    public void writeResponse(Message message,
+                              String base,
+                              Map<String, String> params,
+                              String ctxUri,
+                              EndpointInfo endpointInfo,
+                              OutputStream os) {
         try {
-            int idx = baseUri.toLowerCase().indexOf("?");
-            Map<String, String> params = UrlUtilities.parseQueryString(baseUri.substring(idx + 1));
-
-            String base;
-            
-            if (endpointInfo.getProperty("publishedEndpointUrl") != null) {
-                base = String.valueOf(endpointInfo.getProperty("publishedEndpointUrl"));
-            } else {
-                base = baseUri.substring(0, baseUri.toLowerCase().indexOf("?"));
+            Bus bus = message.getExchange().getBus();
+            Object prop = message.getContextualProperty(PUBLISHED_ENDPOINT_URL);
+            if (prop != null) {
+                base = String.valueOf(prop);
             }
 
             String wsdl = params.get("wsdl");
@@ -138,31 +171,29 @@ public class WSDLQueryHandler implements
             }
             
             Map<String, Definition> mp = CastUtils.cast((Map)endpointInfo.getService()
-                                                        .getProperty(WSDLQueryHandler.class.getName()));
+                                                        .getProperty(WSDLS_KEY));
             Map<String, SchemaReference> smp = CastUtils.cast((Map)endpointInfo.getService()
-                                                        .getProperty(WSDLQueryHandler.class.getName() 
-                                                                     + ".Schemas"));
+                                                        .getProperty(SCHEMAS_KEY));
 
             if (mp == null) {
-                endpointInfo.getService().setProperty(WSDLQueryHandler.class.getName(),
+                endpointInfo.getService().setProperty(WSDLS_KEY,
                                                       new ConcurrentHashMap());
                 mp = CastUtils.cast((Map)endpointInfo.getService()
-                                    .getProperty(WSDLQueryHandler.class.getName()));
+                                    .getProperty(WSDLS_KEY));
             }
             if (smp == null) {
-                endpointInfo.getService().setProperty(WSDLQueryHandler.class.getName()
-                                                      + ".Schemas",
+                endpointInfo.getService().setProperty(SCHEMAS_KEY,
                                                       new ConcurrentHashMap());
                 smp = CastUtils.cast((Map)endpointInfo.getService()
-                                    .getProperty(WSDLQueryHandler.class.getName()
-                                                 + ".Schemas"));
+                                    .getProperty(SCHEMAS_KEY));
             }
             
             if (!mp.containsKey("")) {
-                Definition def = new ServiceWSDLBuilder(bus, endpointInfo.getService()).build();
+                Definition def = new ServiceWSDLBuilder(bus,
+                                                        endpointInfo.getService()).build();
 
                 mp.put("", def);
-                updateDefinition(def, mp, smp, base, endpointInfo);
+                updateDefinition(bus, def, mp, smp, base, endpointInfo);
             }
             
             
@@ -178,16 +209,18 @@ public class WSDLQueryHandler implements
                     }
                 }
                 if (def == null) {
-                    throw new WSDLQueryException(new Message("WSDL_NOT_FOUND", LOG, wsdl), null);
+                    throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("WSDL_NOT_FOUND",
+                                                                                        LOG, wsdl), null);
                 }
                 
                 synchronized (def) {
                     //writing a def is not threadsafe.  Sync on it to make sure
                     //we don't get any ConcurrentModificationExceptions
-                    if (endpointInfo.getProperty("publishedEndpointUrl") != null) {
-                        String publishingUrl = 
-                            String.valueOf(endpointInfo.getProperty("publishedEndpointUrl"));
-                        updatePublishedEndpointUrl(publishingUrl, def, endpointInfo.getName());
+                    if (endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL) != null) {
+                        String epurl = 
+                            String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
+                        updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
+                        base = epurl;
                     }
         
                     WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
@@ -206,7 +239,8 @@ public class WSDLQueryHandler implements
                     }
                 }
                 if (si == null) {
-                    throw new WSDLQueryException(new Message("SCHEMA_NOT_FOUND", LOG, wsdl), null);
+                    throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("SCHEMA_NOT_FOUND", 
+                                                                                        LOG, wsdl), null);
                 }
                 
                 String uri = si.getReferencedSchema().getDocumentBaseURI();
@@ -223,7 +257,7 @@ public class WSDLQueryHandler implements
                 doc = XMLUtils.getParser().parse(src);
             }
             
-            updateDoc(doc, base, mp, smp, endpointInfo);
+            updateDoc(doc, base, mp, smp, message);
             String enc = null;
             try {
                 enc = doc.getXmlEncoding();
@@ -241,17 +275,19 @@ public class WSDLQueryHandler implements
         } catch (WSDLQueryException wex) {
             throw wex;
         } catch (Exception wex) {
-            throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
+            throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
                                                      LOG,
-                                                     baseUri), wex);
+                                                     base), wex);
         }
     }
     
-    protected void updateDoc(Document doc, String base,
+    protected void updateDoc(Document doc, 
+                           String base,
                            Map<String, Definition> mp,
                            Map<String, SchemaReference> smp,
-                           EndpointInfo ei) {        
+                           Message message) {        
         List<Element> elementList = null;
+        Object rewriteSoapAddress = message.getContextualProperty(AUTO_REWRITE_ADDRESS);
         
         try {
             elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
@@ -292,31 +328,32 @@ public class WSDLQueryHandler implements
                 }
             }
         } catch (UnsupportedEncodingException e) {
-            throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
+            throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
                     LOG,
                     base), e);
         }
 
-        Object rewriteSoapAddress = ei.getProperty("autoRewriteSoapAddress");
-
-        if (rewriteSoapAddress != null && MessageUtils.isTrue(rewriteSoapAddress)) {
+        if (rewriteSoapAddress == null || MessageUtils.isTrue(rewriteSoapAddress)) {
             List<Element> serviceList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
                                                               "http://schemas.xmlsoap.org/wsdl/",
                                                               "service");
             for (Element serviceEl : serviceList) {
                 String serviceName = serviceEl.getAttribute("name");
-                if (serviceName.equals(ei.getService().getName().getLocalPart())) {
+                if (serviceName.equals(message.getExchange().getService().getName().getLocalPart())) {
                     elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
                                                                       "http://schemas.xmlsoap.org/wsdl/",
                                                                       "port");
                     for (Element el : elementList) {
                         String name = el.getAttribute("name");
-                        if (name.equals(ei.getName().getLocalPart())) {
-                            Element soapAddress = DOMUtils.findAllElementsByTagNameNS(el,
+                        if (name.equals(message.getExchange().getEndpoint().getEndpointInfo()
+                                            .getName().getLocalPart())) {
+                            
+                            List<Element> sadEls = DOMUtils.findAllElementsByTagNameNS(el,
                                                                  "http://schemas.xmlsoap.org/wsdl/soap/",
-                                                                 "address")
-                                                                       .iterator().next();
-                            soapAddress.setAttribute("location", base);
+                                                                 "address");
+                            for (Element soapAddress : sadEls) {
+                                soapAddress.setAttribute("location", base);
+                            }
                         }
                     }
                 }
@@ -348,7 +385,8 @@ public class WSDLQueryHandler implements
         return resolvedSchemaLocation;
     }
     
-    protected void updateDefinition(Definition def, Map<String, Definition> done,
+    protected void updateDefinition(Bus bus,
+                                    Definition def, Map<String, Definition> done,
                                   Map<String, SchemaReference> doneSchemas,
                                   String base, EndpointInfo ei) {
         OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);    
@@ -365,7 +403,8 @@ public class WSDLQueryHandler implements
                 try {
                     decodedStart = URLDecoder.decode(start, "utf-8");
                 } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
+                    throw new WSDLQueryException(
+                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
                             LOG,
                             start), e);
                 }
@@ -378,13 +417,13 @@ public class WSDLQueryHandler implements
                         new URL(start);
                     } catch (MalformedURLException e) {
                         if (done.put(decodedStart, imp.getDefinition()) == null) {
-                            updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei);
+                            updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, ei);
                         }
                     }
                 } else {
                     if (done.put(decodedStart, imp.getDefinition()) == null) {
                         done.put(resolvedSchemaLocation, imp.getDefinition());
-                        updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei);
+                        updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, ei);
                     }
                 }
             }
@@ -400,7 +439,7 @@ public class WSDLQueryHandler implements
                 : CastUtils.cast((List)types.getExtensibilityElements(), ExtensibilityElement.class)) {
                 if (el instanceof Schema) {
                     Schema see = (Schema)el;
-                    updateSchemaImports(see, doneSchemas, base);
+                    updateSchemaImports(bus, see, doneSchemas, base);
                 }
             }
         }
@@ -438,9 +477,10 @@ public class WSDLQueryHandler implements
         }
     }
     
-    protected void updateSchemaImports(Schema schema,
-                                           Map<String, SchemaReference> doneSchemas,
-                                           String base) {
+    protected void updateSchemaImports(Bus bus, 
+                                       Schema schema,
+                                       Map<String, SchemaReference> doneSchemas,
+                                       String base) {
         OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);    
         Collection<List<?>>  imports = CastUtils.cast((Collection<?>)schema.getImports().values());
         for (List<?> lst : imports) {
@@ -455,7 +495,8 @@ public class WSDLQueryHandler implements
                     try {
                         decodedStart = URLDecoder.decode(start, "utf-8");
                     } catch (UnsupportedEncodingException e) {
-                        throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
+                        throw new WSDLQueryException(
+                                new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
                                 LOG,
                                 start), e);
                     }
@@ -468,13 +509,13 @@ public class WSDLQueryHandler implements
                                 new URL(start);
                             } catch (MalformedURLException e) {
                                 if (doneSchemas.put(decodedStart, imp) == null) {
-                                    updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);
+                                    updateSchemaImports(bus, imp.getReferencedSchema(), doneSchemas, base);
                                 }
                             }
                         } else {
                             if (doneSchemas.put(decodedStart, imp) == null) {
                                 doneSchemas.put(resolvedSchemaLocation, imp);
-                                updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);
+                                updateSchemaImports(bus, imp.getReferencedSchema(), doneSchemas, base);
                             }
                         }
                     }
@@ -493,7 +534,8 @@ public class WSDLQueryHandler implements
                 try {
                     decodedStart = URLDecoder.decode(start, "utf-8");
                 } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
+                    throw new WSDLQueryException(
+                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
                             LOG,
                             start), e);
                 }
@@ -506,7 +548,7 @@ public class WSDLQueryHandler implements
                             new URL(start);
                         } catch (MalformedURLException e) {
                             if (doneSchemas.put(decodedStart, included) == null) {
-                                updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                                updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
                             }
                         }
                     }
@@ -514,7 +556,7 @@ public class WSDLQueryHandler implements
                     || !doneSchemas.containsKey(resolvedSchemaLocation)) {
                     doneSchemas.put(decodedStart, included);
                     doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                    updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
                 }
             }
         }
@@ -529,7 +571,8 @@ public class WSDLQueryHandler implements
                 try {
                     decodedStart = URLDecoder.decode(start, "utf-8");
                 } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(new Message("COULD_NOT_PROVIDE_WSDL",
+                    throw new WSDLQueryException(
+                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
                             LOG,
                             start), e);
                 }
@@ -542,7 +585,7 @@ public class WSDLQueryHandler implements
                             new URL(start);
                         } catch (MalformedURLException e) {
                             if (doneSchemas.put(decodedStart, included) == null) {
-                                updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                                updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
                             }
                         }
                     }
@@ -550,17 +593,10 @@ public class WSDLQueryHandler implements
                     || !doneSchemas.containsKey(resolvedSchemaLocation)) {
                     doneSchemas.put(decodedStart, included);
                     doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                    updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
                 }
             }
         }
     }
-    
-    public boolean isRecognizedQuery(String baseUri, String ctx, EndpointInfo endpointInfo) {
-        return isRecognizedQuery(baseUri, ctx, endpointInfo, false);
-    }
 
-    public void setBus(Bus bus) {
-        this.bus = bus;
-    }
 }

Propchange: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java (from r1073523, cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryException.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java?p2=cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java&p1=cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryException.java&r1=1073523&r2=1073524&rev=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryException.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java Tue Feb 22 21:53:13 2011
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.cxf.transport.http;
+package org.apache.cxf.frontend;
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.i18n.UncheckedException;

Propchange: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLQueryException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java (original)
+++ cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java Tue Feb 22 21:53:13 2011
@@ -705,6 +705,8 @@ public class JettyHTTPDestinationTest ex
                 EasyMock.expect(request.getContextPath()).andReturn("/bar");
                 EasyMock.expect(request.getPathInfo()).andReturn("/foo");
                 EasyMock.expect(request.getRequestURI()).andReturn("/foo");
+                EasyMock.expect(request.getRequestURL())
+                    .andReturn(new StringBuffer("http://localhost/foo")).anyTimes();
                 EasyMock.expect(request.getCharacterEncoding()).andReturn("UTF-8");
                 EasyMock.expect(request.getQueryString()).andReturn(query);    
                 EasyMock.expect(request.getHeader("Accept")).andReturn("*/*");  

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Tue Feb 22 21:53:13 2011
@@ -86,6 +86,7 @@ public abstract class AbstractHTTPDestin
     public static final String HTTP_RESPONSE = "HTTP.RESPONSE";
     public static final String HTTP_CONTEXT = "HTTP.CONTEXT";
     public static final String HTTP_CONFIG = "HTTP.CONFIG";
+    public static final String HTTP_CONTEXT_MATCH_STRATEGY = "HTTP_CONTEXT_MATCH_STRATEGY";
     
     public static final String RESPONSE_HEADERS_COPIED = "http.headers.copied";
     public static final String RESPONSE_COMMITED = "http.response.done";
@@ -229,9 +230,11 @@ public abstract class AbstractHTTPDestin
         inMessage.put(HTTP_RESPONSE, resp);
         inMessage.put(HTTP_CONTEXT, context);
         inMessage.put(HTTP_CONFIG, config);
+        inMessage.put(HTTP_CONTEXT_MATCH_STRATEGY, contextMatchStrategy);
         
         inMessage.put(Message.HTTP_REQUEST_METHOD, req.getMethod());
         inMessage.put(Message.REQUEST_URI, req.getRequestURI());
+        inMessage.put(Message.REQUEST_URL, req.getRequestURL().toString());
         String contextPath = req.getContextPath();
         if (contextPath == null) {
             contextPath = "";

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans_no_autoRewriteSoapAddress.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans_no_autoRewriteSoapAddress.xml?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans_no_autoRewriteSoapAddress.xml (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/beans_no_autoRewriteSoapAddress.xml Tue Feb 22 21:53:13 2011
@@ -39,7 +39,10 @@ http://cxf.apache.org/jaxws http://cxf.a
     	<jaxws:handlers>
     		<bean class="org.apache.cxf.systest.handlers.ModifyNumberHandler"/>
     	</jaxws:handlers>
-        </jaxws:endpoint>
+        <jaxws:properties>
+                <entry key="autoRewriteSoapAddress" value="false"/>
+        </jaxws:properties>
+    </jaxws:endpoint>
 	<jaxws:server id="cxfHandlerTestServer"
 		serviceClass="org.apache.handlers.AddNumbers"
 		address="http://localhost:${testutil.ports.springportNoAutoRewriteSoapAddressTest}/SpringServer">

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Tue Feb 22 21:53:13 2011
@@ -108,7 +108,7 @@ public class ClientServerTest extends Ab
         assertNotNull("cannot find test resource", url);
         defaultConfigFileName = url.toString();
 
-        assertTrue("server did not launch correctly", launchServer(Server.class));
+        assertTrue("server did not launch correctly", launchServer(Server.class, true));
     }
     @Test
     public void testCXF2419() throws Exception {

Modified: cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?rev=1073524&r1=1073523&r2=1073524&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Tue Feb 22 21:53:13 2011
@@ -30,6 +30,7 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
@@ -161,7 +162,15 @@ public class ServerLauncher {
 
         if (inProcess) {
             Class<?> cls;
+            Map<String, String> old = new HashMap<String, String>();
             try {
+                if (null != properties) {
+                    for (Map.Entry<String, String> entry : properties.entrySet()) {
+                        old.put(entry.getKey(), System.getProperty(entry.getKey()));
+                        System.setProperty(entry.getKey(), entry.getValue());
+                    }
+                }
+                
                 cls = Class.forName(className);
                 Class<? extends AbstractTestServerBase> svcls = 
                     cls.asSubclass(AbstractTestServerBase.class);
@@ -177,6 +186,15 @@ public class ServerLauncher {
             } catch (Throwable ex) {
                 ex.printStackTrace();
                 serverLaunchFailed = true;
+            } finally {
+                for (Map.Entry<String, String> entry : old.entrySet()) {
+                    if (entry.getValue() == null) {
+                        System.clearProperty(entry.getKey());
+                    } else {
+                        System.setProperty(entry.getKey(), entry.getValue());
+                    }
+                }
+
             }
         } else {
             List<String> cmd;



Mime
View raw message