cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1367243 - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/ rt/transports/http...
Date Mon, 30 Jul 2012 19:38:16 GMT
Author: dkulp
Date: Mon Jul 30 19:38:16 2012
New Revision: 1367243

URL: http://svn.apache.org/viewvc?rev=1367243&view=rev
Log:
Update to use URI in the http conduits instead of URL as using a URL can
be fairly expensive (particularly in Felix, not so bad in Equinox)

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthOutInterceptor.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ProxyFactory.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DigestAuthSupplier.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthSupplier.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/SpnegoAuthSupplier.java
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DigestAuthSupplierTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthOutInterceptor.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/security/KerberosAuthOutInterceptor.java
Mon Jul 30 19:38:16 2012
@@ -18,8 +18,8 @@
  */
 package org.apache.cxf.jaxrs.security;
 
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -49,9 +49,9 @@ public class KerberosAuthOutInterceptor 
     }
     
     public void handleMessage(Message message) throws Fault {
-        URL currentURL = getCurrentURL(message);
+        URI currentURI = getCurrentURI(message);
         String value = super.getAuthorization(getPolicy(), 
-                                              currentURL, 
+                                              currentURI, 
                                               message);
         Map<String, List<String>> headers = 
             CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
@@ -62,12 +62,12 @@ public class KerberosAuthOutInterceptor 
         headers.put("Authorization", Collections.singletonList(value));
     }
     
-    private URL getCurrentURL(Message message) {
+    private URI getCurrentURI(Message message) {
         try {
-            return new URL((String)message.get(Message.ENDPOINT_ADDRESS));
-        } catch (MalformedURLException ex) {
+            return new URI((String)message.get(Message.ENDPOINT_ADDRESS));
+        } catch (URISyntaxException e) {
             // is not expected to happen
-            throw new RuntimeException(ex);
+            throw new RuntimeException(e);
         }
     }
 

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Mon Jul 30 19:38:16 2012
@@ -27,6 +27,8 @@ import java.io.OutputStream;
 import java.net.HttpRetryException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -193,11 +195,11 @@ public abstract class HTTPConduit 
     
 
     /**
-     * This field holds the "default" URL for this particular conduit, which
+     * This field holds the "default" URI for this particular conduit, which
      * is created on demand.
      */
-    protected URL defaultEndpointURL;
-    protected String defaultEndpointURLString;
+    protected URI defaultEndpointURI;
+    protected String defaultEndpointURIString;
     protected boolean fromEndpointReferenceType;
     
     protected ProxyFactory proxyFactory;
@@ -425,7 +427,7 @@ public abstract class HTTPConduit 
     }
     
 
-    protected abstract void setupConnection(Message message, URL url, HTTPClientPolicy csPolicy)
throws IOException;
+    protected abstract void setupConnection(Message message, URI url, HTTPClientPolicy csPolicy)
throws IOException;
 
     /**
      * Prepare to send an outbound HTTP message over this http conduit to a 
@@ -452,13 +454,18 @@ public abstract class HTTPConduit 
         // This call can possibly change the conduit endpoint address and 
         // protocol from the default set in EndpointInfo that is associated
         // with the Conduit.
-        URL currentURL = setupURL(message);       
+        URI currentURI;
+        try {
+            currentURI = setupURI(message);
+        } catch (URISyntaxException e) {
+            throw new IOException(e);
+        }       
 
         // The need to cache the request is off by default
         boolean needToCacheRequest = false;
         
         HTTPClientPolicy csPolicy = getClient(message);
-        setupConnection(message, currentURL, csPolicy);
+        setupConnection(message, currentURI, csPolicy);
         
         // If the HTTP_REQUEST_METHOD is not set, the default is "POST".
         String httpRequestMethod = 
@@ -518,7 +525,7 @@ public abstract class HTTPConduit 
             message.getInterceptorChain().add(CertConstraintsInterceptor.INSTANCE);
         }
 
-        setHeadersByAuthorizationPolicy(message, currentURL);
+        setHeadersByAuthorizationPolicy(message, currentURI);
         new Headers(message).setFromClientPolicy(getClient(message));
         message.setContent(OutputStream.class, 
                            createOutputStream(message,
@@ -633,18 +640,19 @@ public abstract class HTTPConduit 
      * @return The full URL specifying the HTTP request to the endpoint.
      * 
      * @throws MalformedURLException
+     * @throws URISyntaxException 
      */
-    private URL setupURL(Message message) throws MalformedURLException {
+    private URI setupURI(Message message) throws URISyntaxException {
         String result = (String)message.get(Message.ENDPOINT_ADDRESS);
         String pathInfo = (String)message.get(Message.PATH_INFO);
         String queryString = (String)message.get(Message.QUERY_STRING);
         if (result == null) {
             if (pathInfo == null && queryString == null) {
-                URL url = getURL();
-                message.put(Message.ENDPOINT_ADDRESS, defaultEndpointURLString);
-                return url;
+                URI uri = getURI();
+                message.put(Message.ENDPOINT_ADDRESS, defaultEndpointURIString);
+                return uri;
             }
-            result = getURL().toString();
+            result = getURI().toString();
             message.put(Message.ENDPOINT_ADDRESS, result);
         }
         
@@ -655,7 +663,7 @@ public abstract class HTTPConduit 
         if (queryString != null) {
             result = result + "?" + queryString;
         }        
-        return new URL(result);    
+        return new URI(result);    
     }
 
 
@@ -672,8 +680,8 @@ public abstract class HTTPConduit 
      * @return the default target address
      */
     public String getAddress() {
-        if (defaultEndpointURL != null) {
-            return defaultEndpointURLString;
+        if (defaultEndpointURI != null) {
+            return defaultEndpointURIString;
         } else if (fromEndpointReferenceType) {
             return getTarget().getAddress().getValue();
         }
@@ -683,29 +691,32 @@ public abstract class HTTPConduit 
     /**
      * @return the default target URL
      */
-    protected URL getURL() throws MalformedURLException {
-        return getURL(true);
+    protected URI getURI() throws URISyntaxException {
+        return getURI(true);
     }
 
     /**
      * @param createOnDemand create URL on-demand if null
      * @return the default target URL
+     * @throws URISyntaxException 
      */
-    protected synchronized URL getURL(boolean createOnDemand)
-        throws MalformedURLException {
-        if (defaultEndpointURL == null && createOnDemand) {
+    protected synchronized URI getURI(boolean createOnDemand)
+        throws URISyntaxException {
+        if (defaultEndpointURI == null && createOnDemand) {
             if (fromEndpointReferenceType && getTarget().getAddress().getValue()
!= null) {
-                defaultEndpointURL = new URL(this.getTarget().getAddress().getValue());
-                defaultEndpointURLString = defaultEndpointURL.toExternalForm();
-                return defaultEndpointURL;
+                defaultEndpointURI = new URI(this.getTarget().getAddress().getValue());
+                defaultEndpointURIString = defaultEndpointURI.toString();
+                return defaultEndpointURI;
             }
             if (endpointInfo.getAddress() == null) {
-                throw new MalformedURLException("Invalid address. Endpoint address cannot
be null.");
+                throw new URISyntaxException("<null>", 
+                                             "Invalid address. Endpoint address cannot be
null.",
+                                             0);
             }
-            defaultEndpointURL = new URL(endpointInfo.getAddress());
-            defaultEndpointURLString = defaultEndpointURL.toExternalForm();
+            defaultEndpointURI = new URI(endpointInfo.getAddress());
+            defaultEndpointURIString = defaultEndpointURI.toString();
         }
-        return defaultEndpointURL;
+        return defaultEndpointURI;
     }
 
     /**
@@ -732,17 +743,17 @@ public abstract class HTTPConduit 
      */
     protected void setHeadersByAuthorizationPolicy(
             Message message,
-            URL url
+            URI currentURI
     ) {
         Headers headers = new Headers(message);
         AuthorizationPolicy effectiveAuthPolicy = getEffectiveAuthPolicy(message);
-        String authString = authSupplier.getAuthorization(effectiveAuthPolicy, url, message,
null);
+        String authString = authSupplier.getAuthorization(effectiveAuthPolicy, currentURI,
message, null);
         if (authString != null) {
             headers.setAuthorization(authString);
         }
         
         String proxyAuthString = authSupplier.getAuthorization(proxyAuthorizationPolicy,

-                                                               url, message, null);
+                                                               currentURI, message, null);
         if (proxyAuthString != null) {
             headers.setProxyAuthorization(proxyAuthString);
         }
@@ -1379,7 +1390,11 @@ public abstract class HTTPConduit 
                 // it is meant to make it to the end. (Too bad that information
                 // went to every URL along the way, but that's what the user 
                 // wants!
-                setHeadersByAuthorizationPolicy(outMessage, new URL(newURL));
+                try {
+                    setHeadersByAuthorizationPolicy(outMessage, new URI(newURL));
+                } catch (URISyntaxException e) {
+                    throw new IOException(e);
+                }
                 retransmit(newURL);
                 return true;
             }
@@ -1400,13 +1415,18 @@ public abstract class HTTPConduit 
             Message m = new MessageImpl();
             updateResponseHeaders(m);
             HttpAuthHeader authHeader = new HttpAuthHeader(Headers.getSetProtocolHeaders(m).get("WWW-Authenticate"));
-            URL currentURL = new URL(url);
+            URI currentURI;
+            try {
+                currentURI = new URI(url);
+            } catch (URISyntaxException e) {
+                throw new IOException(e);
+            }
             String realm = authHeader.getRealm();
-            detectAuthorizationLoop(getConduitName(), outMessage, currentURL, realm);
+            detectAuthorizationLoop(getConduitName(), outMessage, currentURI, realm);
             AuthorizationPolicy effectiveAthPolicy = getEffectiveAuthPolicy(outMessage);
             String authorizationToken = 
                 authSupplier.getAuthorization(
-                    effectiveAthPolicy, currentURL, outMessage, authHeader.getFullHeader());
+                    effectiveAthPolicy, currentURI, outMessage, authHeader.getFullHeader());
             if (authorizationToken == null) {
                 // authentication not possible => we give up
                 return false;
@@ -1693,7 +1713,7 @@ public abstract class HTTPConduit 
         }
     }   
     private static void detectAuthorizationLoop(String conduitName, Message message, 
-                                                URL currentURL, String realm) throws IOException
{
+                                                URI currentURL, String realm) throws IOException
{
         @SuppressWarnings("unchecked")
         Set<String> authURLs = (Set<String>) message.get(KEY_AUTH_URLS);
         if (authURLs == null) {

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ProxyFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ProxyFactory.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ProxyFactory.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/ProxyFactory.java
Mon Jul 30 19:38:16 2012
@@ -20,7 +20,7 @@ package org.apache.cxf.transport.http;
 
 import java.net.InetSocketAddress;
 import java.net.Proxy;
-import java.net.URL;
+import java.net.URI;
 import java.util.regex.Pattern;
 
 import org.apache.cxf.common.util.StringUtils;
@@ -89,7 +89,7 @@ public class ProxyFactory {
      * 
      * @return The proxy server or null, if not set.
      */
-    public Proxy createProxy(HTTPClientPolicy policy, URL currentUrl) {
+    public Proxy createProxy(HTTPClientPolicy policy, URI currentUrl) {
         if (policy != null) {
             // Maybe the user has provided some proxy information
             if (policy.isSetProxyServer()

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
Mon Jul 30 19:38:16 2012
@@ -24,6 +24,8 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.Proxy;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.util.logging.Level;
@@ -71,9 +73,9 @@ public class URLConnectionHTTPConduit ex
      */
     public void close() {
         super.close();
-        if (defaultEndpointURL != null) {
+        if (defaultEndpointURI != null) {
             try {
-                URLConnection connect = defaultEndpointURL.openConnection();
+                URLConnection connect = defaultEndpointURI.toURL().openConnection();
                 if (connect instanceof HttpURLConnection) {
                     ((HttpURLConnection)connect).disconnect();
                 }
@@ -84,11 +86,12 @@ public class URLConnectionHTTPConduit ex
         }
     }    
     
-    private HttpURLConnection createConnection(Message message, URL url, HTTPClientPolicy
csPolicy) throws IOException {
-        Proxy proxy = proxyFactory.createProxy(csPolicy , url);
+    private HttpURLConnection createConnection(Message message, URI uri, HTTPClientPolicy
csPolicy) throws IOException {
+        URL url = uri.toURL();
+        Proxy proxy = proxyFactory.createProxy(csPolicy , uri);
         return connectionFactory.createConnection(tlsClientParameters, proxy, url);
     }
-    protected void setupConnection(Message message, URL currentURL, HTTPClientPolicy csPolicy)
throws IOException {
+    protected void setupConnection(Message message, URI currentURL, HTTPClientPolicy csPolicy)
throws IOException {
         HttpURLConnection connection = createConnection(message, currentURL, csPolicy);
         connection.setDoOutput(true);       
         
@@ -252,7 +255,12 @@ public class URLConnectionHTTPConduit ex
         }
         protected void setupNewConnection(String newURL) throws IOException {
             HTTPClientPolicy cp = getClient(outMessage);
-            URL nurl = new URL(newURL);
+            URI nurl;
+            try {
+                nurl = new URI(newURL);
+            } catch (URISyntaxException e) {
+                throw new IOException(e);
+            }
             setupConnection(outMessage, nurl, cp);
             url = newURL;
             connection = (HttpURLConnection)outMessage.get(KEY_HTTP_CONNECTION);

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java
Mon Jul 30 19:38:16 2012
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.transport.http.auth;
 
-import java.net.URL;
+import java.net.URI;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.logging.Level;
@@ -63,13 +63,13 @@ public abstract class AbstractSpnegoAuth
     private Configuration loginConfig;
     
     public String getAuthorization(AuthorizationPolicy authPolicy,
-                                   URL currentURL,
+                                   URI currentURI,
                                    Message message) {
         if (!HttpAuthHeader.AUTH_TYPE_NEGOTIATE.equals(authPolicy.getAuthorizationType()))
{
             return null;
         }
         try {
-            String spn = getCompleteServicePrincipalName(currentURL);
+            String spn = getCompleteServicePrincipalName(currentURI);
             
             boolean useKerberosOid = MessageUtils.isTrue(
                 message.getContextualProperty(PROPERTY_USE_KERBEROS_OID));
@@ -164,9 +164,9 @@ public abstract class AbstractSpnegoAuth
         return prop == null ? credDelegation : MessageUtils.isTrue(prop);
     }
 
-    protected String getCompleteServicePrincipalName(URL currentURL) {
+    protected String getCompleteServicePrincipalName(URI currentURI) {
         String name = servicePrincipalName == null 
-            ? "HTTP/" + currentURL.getHost() : servicePrincipalName;
+            ? "HTTP/" + currentURI.getHost() : servicePrincipalName;
         if (realm != null) {            
             name += "@" + realm;
         }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DefaultBasicAuthSupplier.java
Mon Jul 30 19:38:16 2012
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.transport.http.auth;
 
-import java.net.URL;
+import java.net.URI;
 
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
@@ -39,7 +39,7 @@ public final class DefaultBasicAuthSuppl
     }
 
     public String getAuthorization(AuthorizationPolicy  authPolicy,
-                                   URL currentURL,
+                                   URI currentURI,
                                    Message message,
                                    String fullHeader) {
         if (authPolicy.getUserName() != null && authPolicy.getPassword() != null)
{

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DigestAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DigestAuthSupplier.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DigestAuthSupplier.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/DigestAuthSupplier.java
Mon Jul 30 19:38:16 2012
@@ -21,7 +21,6 @@ package org.apache.cxf.transport.http.au
 
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
-import java.net.URL;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.HashMap;
@@ -62,20 +61,20 @@ public class DigestAuthSupplier implemen
     }
 
     public String getAuthorization(AuthorizationPolicy authPolicy,
-                                   URL currentURL,
+                                   URI currentURI,
                                    Message message,
                                    String fullHeader) {
         if (authPolicy.getUserName() == null && authPolicy.getPassword() == null)
{
             return null;
         }
-        URI currentURI = URI.create(currentURL.toString());
+        
         if (fullHeader == null) {
             DigestInfo di = authInfo.get(currentURI);
             if (di != null) {
                 /* Preemptive authentication is only possible if we have a cached
                  * challenge
                  */
-                return di.generateAuth(currentURL.getFile(), 
+                return di.generateAuth(currentURI.getPath(), 
                                        authPolicy.getUserName(),
                                        authPolicy.getPassword());            
             } else {
@@ -104,7 +103,7 @@ public class DigestAuthSupplier implemen
                 }
                 authInfo.put(currentURI, di);
                 
-                return di.generateAuth(currentURL.getFile(), 
+                return di.generateAuth(currentURI.getPath(), 
                                        authPolicy.getUserName(),
                                        authPolicy.getPassword());
             }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthSupplier.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthSupplier.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/HttpAuthSupplier.java
Mon Jul 30 19:38:16 2012
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.transport.http.auth;
 
-import java.net.URL;
+import java.net.URI;
 
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.message.Message;
@@ -50,14 +50,14 @@ public interface HttpAuthSupplier {
      * an Authentication token for http authentication.
      * 
      * @param authPolicy credentials for the authentication
-     * @param url The URL we want to connect to
+     * @param uri  The URI we want to connect to
      * @param message     The CXF Message
      * @param fullHeader  The full WWW-Authenticate header or null if preemptive auth
      * @return token for Authenticate string or null if authentication is not possible
      */
     String getAuthorization(
             AuthorizationPolicy  authPolicy,
-            URL     url,
+            URI     url,
             Message message,
             String  fullHeader);
 }

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/SpnegoAuthSupplier.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/SpnegoAuthSupplier.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/SpnegoAuthSupplier.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/SpnegoAuthSupplier.java
Mon Jul 30 19:38:16 2012
@@ -18,7 +18,7 @@
  */
 package org.apache.cxf.transport.http.auth;
 
-import java.net.URL;
+import java.net.URI;
 
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.message.Message;
@@ -31,10 +31,10 @@ public class SpnegoAuthSupplier extends 
     }
 
     public String getAuthorization(AuthorizationPolicy  authPolicy,
-                                    URL currentURL,
+                                    URI currentURI,
                                     Message message,
                                     String fullHeader) {
-        return super.getAuthorization(authPolicy, currentURL, message);
+        return super.getAuthorization(authPolicy, currentURI, message);
     }
 
 }

Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
(original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
Mon Jul 30 19:38:16 2012
@@ -21,7 +21,7 @@ package org.apache.cxf.transport.http;
 
 
 import java.io.OutputStream;
-import java.net.URL;
+import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -71,7 +71,7 @@ public class HTTPConduitTest extends Ass
 
     private final class TestAuthSupplier implements HttpAuthSupplier {
 
-        public String getAuthorization(AuthorizationPolicy authPolicy, URL currentURL, Message
message,
+        public String getAuthorization(AuthorizationPolicy authPolicy, URI currentURI, Message
message,
                                        String fullHeader) {
             return "myauth";
         }
@@ -109,9 +109,9 @@ public class HTTPConduitTest extends Ass
                      conduit.getAddress(),
                      "http://nowhere.com/bar/foo");
         assertNull("unexpected upfront URL",
-                    conduit.getURL(false));
+                    conduit.getURI(false));
         assertEquals("unexpected on-demand URL",
-                     conduit.getURL().getPath(),
+                     conduit.getURI().getPath(),
                      "/bar/foo");
     }
     

Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DigestAuthSupplierTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DigestAuthSupplierTest.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DigestAuthSupplierTest.java
(original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/auth/DigestAuthSupplierTest.java
Mon Jul 30 19:38:16 2012
@@ -19,8 +19,7 @@
 package org.apache.cxf.transport.http.auth;
 
 import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -53,7 +52,7 @@ public class DigestAuthSupplierTest {
     }
 
     @Test
-    public void testEncode() throws MalformedURLException {
+    public void testEncode() throws Exception {
         String origNonce = "MTI0ODg3OTc5NzE2OTplZGUyYTg0Yzk2NTFkY2YyNjc1Y2JjZjU2MTUzZmQyYw==";
         String fullHeader = "Digest realm=\"MyCompany realm.\", qop=\"auth\"," + "nonce=\""
+ origNonce
                             + "\"";
@@ -74,12 +73,12 @@ public class DigestAuthSupplierTest {
         AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
         authorizationPolicy.setUserName("testUser");
         authorizationPolicy.setPassword("testPassword");
-        URL url = new URL("http://myserver");
+        URI uri = new URI("http://myserver");
         Message message = new MessageImpl();
         control.replay();
         
         String authToken = authSupplier
-            .getAuthorization(authorizationPolicy, url, message, fullHeader);
+            .getAuthorization(authorizationPolicy, uri, message, fullHeader);
         HttpAuthHeader authHeader = new HttpAuthHeader(authToken);
         assertEquals("Digest", authHeader.getAuthType());
         Map<String, String> params = authHeader.getParams();

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java?rev=1367243&r1=1367242&r2=1367243&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPConduitTest.java
Mon Jul 30 19:38:16 2012
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.security.GeneralSecurityException;
 import java.security.KeyStore;
@@ -799,7 +800,7 @@ public class HTTPConduitTest extends Abs
          */
         public String getAuthorization(
                 AuthorizationPolicy authPolicy,
-                URL     currentURL,
+                URI     currentURI,
                 Message message,
                 String fullHeader
         ) {



Mime
View raw message