Author: dkulp
Date: Fri Nov 14 13:21:00 2008
New Revision: 714149

URL: http://svn.apache.org/viewvc?rev=714149&view=rev
Log:
Merged revisions 713594 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r713594 | dkulp | 2008-11-12 19:59:56 -0500 (Wed, 12 Nov 2008) | 11 lines
  
  Merged revisions 713584 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r713584 | dkulp | 2008-11-12 19:49:27 -0500 (Wed, 12 Nov 2008) | 4 lines
    
    Install a real HostnameVerifier that should work (need to make this more 
configurable)
    Make the Configuration wildcarding actually use regex wildcards.
    Update to HttpConduits to configure based on the address URL as well as 
endpoint name.
  ........
................

Added:
    
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/CertificateHostnameVerifier.java
      - copied unchanged from r713594, 
cxf/branches/2.1.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/CertificateHostnameVerifier.java
    
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
      - copied unchanged from r713594, 
cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    
cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
    
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
    
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
    
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
    
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
    
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
    
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java
   (props changed)

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 14 13:21:00 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,703523,704303,704587,704738,704998,705153,705280-705449,705455,709357,709641,709644,710177,710184,711736,712199,712225,712275,712600,712896,713083,713410,713413
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,703501,704584,704997,705150,705274,705340,705446,708550,708554,709353-709354,709425,710150,712194,712198,712272,712312,712670,712893,713082
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,703523,704303,704587,704738,704998,705153,705280-705449,705455,709357,709641,709644,710177,710184,711736,712199,712225,712275,712600,712896,713083,713410,713413,713594
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,703501,704584,704997,705150,705274,705340,705446,708550,708554,709353-709354,709425,710150,712194,712198,712272,712312,712670,712893,713082,713584
 /incubator/cxf/trunk:434594-651668

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: 
cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
 Fri Nov 14 13:21:00 2008
@@ -24,6 +24,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
@@ -32,6 +33,8 @@
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.ws.addressing.AttributedURIType;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
 
 /**
@@ -70,7 +73,17 @@
                     ConduitInitiator conduitInitiator =
                         conduitInitiatorMgr.getConduitInitiator(transportID);
                     if (conduitInitiator != null) {
-                        selectedConduit = conduitInitiator.getConduit(ei);
+                        String add = 
(String)message.get(Message.ENDPOINT_ADDRESS);
+                        if (StringUtils.isEmpty(add)
+                            || add.equals(ei.getAddress())) {
+                            selectedConduit = conduitInitiator.getConduit(ei);
+                        } else {
+                            EndpointReferenceType epr = new 
EndpointReferenceType();
+                            AttributedURIType ad = new AttributedURIType();
+                            ad.setValue(add);
+                            epr.setAddress(ad);
+                            selectedConduit = conduitInitiator.getConduit(ei, 
epr);
+                        }
                         MessageObserver observer = 
                             exchange.get(MessageObserver.class);
                         if (observer != null) {

Modified: 
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java
 Fri Nov 14 13:21:00 2008
@@ -20,12 +20,16 @@
 package org.apache.cxf.configuration.spring;
 
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurable;
@@ -47,7 +51,17 @@
     private static final Logger LOG = 
LogUtils.getL7dLogger(ConfigurerImpl.class);
 
     private Set<ApplicationContext> appContexts;
-    private final Map<String, String> wildCardBeanDefinitions = new 
HashMap<String, String>();
+    private final Map<String, List<MatcherHolder>> wildCardBeanDefinitions
+        = new HashMap<String, List<MatcherHolder>>();
+    
+    static class MatcherHolder {
+        Matcher matcher;
+        String wildCardId;
+        public MatcherHolder(String orig, Matcher matcher) {
+            wildCardId = orig;
+            this.matcher = matcher;
+        }
+    }
     
     public ConfigurerImpl() {
         // complete
@@ -67,14 +81,19 @@
                         BeanDefinition bd = bdr.getBeanDefinition(n);
                         String className = bd.getBeanClassName();
                         if (null != className) {
-                            if 
(!wildCardBeanDefinitions.containsKey(className)) {
-                                wildCardBeanDefinitions.put(className, n);
-                            } else {
-                                LogUtils.log(LOG, Level.WARNING, 
"ONE_WILDCARD_BEAN_ID_PER_CLASS_MSG", 
-                                             new 
String[]{wildCardBeanDefinitions.get(className),
-                                                          className,
-                                                          n});   
+                            String orig = n;
+                            if (n.charAt(0) == '*') {
+                                //old wildcard
+                                n = "." + n.replaceAll("\\.", "\\."); 
                             }
+                            Matcher matcher = Pattern.compile(n).matcher("");
+                            List<MatcherHolder> m = 
wildCardBeanDefinitions.get(className);
+                            if (m == null) {
+                                m = new ArrayList<MatcherHolder>();
+                                wildCardBeanDefinitions.put(className, m);
+                            }
+                            MatcherHolder holder = new MatcherHolder(orig, 
matcher);
+                            m.add(holder);
                         } else {
                             LogUtils.log(LOG, Level.WARNING, 
"WILDCARD_BEAN_ID_WITH_NO_CLASS_MSG", n); 
                         }
@@ -138,21 +157,24 @@
     private void configureWithWildCard(String bn, Object beanInstance) {
         if (!wildCardBeanDefinitions.isEmpty() && !isWildcardBeanName(bn)) {
             String className = beanInstance.getClass().getName();
-            if (wildCardBeanDefinitions.containsKey(className)) {
-                String wildCardBeanId = wildCardBeanDefinitions.get(className);
-                if (bn.endsWith(stripStar(wildCardBeanId))) {
-                    configureBean(wildCardBeanId, beanInstance);
-                }       
+            List<MatcherHolder> matchers = 
wildCardBeanDefinitions.get(className);
+            if (matchers != null) {
+                for (MatcherHolder m : matchers) {
+                    synchronized (m.matcher) {
+                        m.matcher.reset(bn);
+                        if (m.matcher.matches()) {
+                            configureBean(m.wildCardId, beanInstance);
+                            return;
+                        }
+                    }
+                }
             }
         }
     }
 
     private boolean isWildcardBeanName(String bn) {
-        return bn.charAt(0) == '*';
-    }
-
-    private String stripStar(String wildCardBeanId) {
-        return wildCardBeanId.substring(1);
+        return bn.indexOf('*') != -1 || bn.indexOf('?') != -1
+            || (bn.indexOf('(') != -1 && bn.indexOf(')') != -1);
     }
 
     protected String getBeanName(Object beanInstance) {

Modified: 
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
 Fri Nov 14 13:21:00 2008
@@ -39,6 +39,7 @@
     private static final Logger LOG = 
LogUtils.getL7dLogger(ServiceDelegateAccessor.class);
 
     private static final String DELEGATE_FIELD_NAME = "delegate";
+    private static final String DELEGATE_FIELD_NAME2 = "_delegate";
 
     private ServiceDelegateAccessor() {        
     }
@@ -59,11 +60,18 @@
             delegateField.setAccessible(true);
             delegate = (ServiceImpl)delegateField.get(service);
         } catch (Exception e) {
-            WebServiceException wse = new WebServiceException("Failed to 
access Field named "
-                                                              + 
DELEGATE_FIELD_NAME + " of Service instance "
-                                                              + service, e);
-            LOG.log(Level.SEVERE, e.getMessage(), e);
-            throw wse;
+            try {
+                Field delegateField = 
Service.class.getDeclaredField(DELEGATE_FIELD_NAME2);
+                delegateField.setAccessible(true);
+                delegate = (ServiceImpl)delegateField.get(service);
+            } catch (Exception e2) {
+                WebServiceException wse = new WebServiceException("Failed to 
access Field named "
+                                                                  + 
DELEGATE_FIELD_NAME 
+                                                                  + " of 
Service instance "
+                                                                  + service, 
e);
+                LOG.log(Level.SEVERE, e.getMessage(), e);
+                throw wse;                
+            }
         }
         return delegate;
     }

Modified: 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
 Fri Nov 14 13:21:00 2008
@@ -158,9 +158,8 @@
         HTTPConduit conduit = target == null
             ? new HTTPConduit(bus, endpointInfo)
             : new HTTPConduit(bus, endpointInfo, target);
-        
         // Spring configure the conduit.  
-        configure(conduit);
+        configure(conduit, conduit.getAddress());
         conduit.finalizeConfig();
         return conduit;
     }
@@ -218,9 +217,15 @@
      * @param bean
      */
     protected void configure(Object bean) {
+        configure(bean, null);
+    }
+    protected void configure(Object bean, String extraName) {
         Configurer configurer = bus.getExtension(Configurer.class);
         if (null != configurer) {
             configurer.configureBean(bean);
+            if (extraName != null) {
+                configurer.configureBean(extraName, bean);
+            }
         }
     }
 

Modified: 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
 Fri Nov 14 13:21:00 2008
@@ -676,8 +676,10 @@
         String pathInfo = (String)message.get(Message.PATH_INFO);
         String queryString = (String)message.get(Message.QUERY_STRING);
         if (result == null) {
+            if (pathInfo == null && queryString == null) {
+                return getURL();
+            }
             result = getURL().toString();
-            
         }
         
         // REVISIT: is this really correct?

Modified: 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/https/HttpsURLConnectionFactory.java
 Fri Nov 14 13:21:00 2008
@@ -30,10 +30,8 @@
 import java.util.logging.Logger;
 
 import javax.imageio.IIOException;
-import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSocketFactory;
 
 import org.apache.cxf.common.logging.LogUtils;
@@ -60,8 +58,6 @@
     private static final Logger LOG =
         LogUtils.getL7dLogger(HttpsURLConnectionFactory.class);
     
-    private static final HostnameVerifier DISABLE_HOSTNAME_VERIFIER = new 
AlwaysTrueHostnameVerifier();
-    
     /*
      *  For development and testing only
      */
@@ -151,25 +147,6 @@
 
         return connection;
     }
-
-    /**
-     * This "accept all" hostname verifier is activated when the 
-     * disableCNCheck TLS client configuration parameter is set to 
-     * true (not recommended for production use).  The default of
-     * false makes sure the Common Name (CN) on the server 
-     * certificate equals that of the https:// URL provided by
-     * the SOAP client.
-     */
-    private static class AlwaysTrueHostnameVerifier implements 
HostnameVerifier {
-
-        public boolean verify(
-            String      hostname,
-            SSLSession  sslSession
-        ) {
-            return true;
-        }
-
-    }
     
     /**
      * This method assigns the various TLS parameters on the HttpsURLConnection
@@ -209,7 +186,9 @@
                                                         
tlsClientParameters.getSecureSocketProtocol());
         }
         if (tlsClientParameters.isDisableCNCheck()) {
-            connection.setHostnameVerifier(DISABLE_HOSTNAME_VERIFIER);
+            
connection.setHostnameVerifier(CertificateHostnameVerifier.ALLOW_ALL);
+        } else {
+            
connection.setHostnameVerifier(CertificateHostnameVerifier.DEFAULT);
         }
         connection.setSSLSocketFactory(socketFactory);
     }

Modified: 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
 Fri Nov 14 13:21:00 2008
@@ -82,7 +82,6 @@
         startServers();
         SOAPService service = new SOAPService();
         assertNotNull("Service is null", service);   
-        
         final Greeter port = service.getHttpsPort();
         assertNotNull("Port is null", port);
         
@@ -118,4 +117,9 @@
         testSuccessfulCall("resources/resource-key-spec.xml",
                            "https://localhost:9004/SoapContext/HttpsPort";);
     }
+    @Test
+    public final void testResourceKeySpecEndpointURL() throws Exception {
+        testSuccessfulCall("resources/resource-key-spec-url.xml",
+                           "https://localhost:9005/SoapContext/HttpsPort";);
+    }
 }

Modified: 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=714149&r1=714148&r2=714149&view=diff
==============================================================================
--- 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
 (original)
+++ 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
 Fri Nov 14 13:21:00 2008
@@ -817,6 +817,15 @@
         String realAddress = "http://localhost:9015/SoapContext/SoapPort";;
         SOAPServiceBogusAddressTest service = new 
SOAPServiceBogusAddressTest();
         Greeter greeter = service.getSoapPort();
+        try {
+            greeter.greetMe("test");
+            fail("Should fail");
+        } catch (WebServiceException f) {
+            // expected
+        }
+
+        
+        
         BindingProvider bp = (BindingProvider)greeter;
         bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                    realAddress);

Propchange: 
cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Nov 14 13:21:00 2008
@@ -1 +1 @@
-/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java:712600,713083,713410,713413
+/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/wsdl/CrossSchemaImportsTests.java:712600,713083,713410,713413,713594


Reply via email to