cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clecl...@apache.org
Subject svn commit: r909935 - in /cxf/branches/2.2.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Date Sat, 13 Feb 2010 23:55:55 GMT
Author: cleclerc
Date: Sat Feb 13 23:55:54 2010
New Revision: 909935

URL: http://svn.apache.org/viewvc?rev=909935&view=rev
Log:
Merged revisions 909927,909933 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r909927 | cleclerc | 2010-02-14 00:27:11 +0100 (Sun, 14 Feb 2010) | 1 line
  
  [CXF-2672] Enhance CXF client message in case of HttpRetryException (http codes 401 and
407)
........
  r909933 | cleclerc | 2010-02-14 00:52:17 +0100 (Sun, 14 Feb 2010) | 2 lines
  
  [CXF-2672] Enhance CXF client message in case of HttpRetryException (http codes 401 and
407)
  Fix JDK 1.5 compatibility
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:909927-909933

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

Modified: cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?rev=909935&r1=909934&r2=909935&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Sat Feb 13 23:55:54 2010
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PushbackInputStream;
+import java.net.HttpRetryException;
 import java.net.HttpURLConnection;
 import java.net.InetSocketAddress;
 import java.net.MalformedURLException;
@@ -1983,6 +1984,49 @@
             }
             try {
                 handleResponse();
+            } catch (HttpRetryException e) {
+                String msg = "HTTP response '" + e.responseCode() + ": "
+                             + connection.getResponseMessage() + "' invoking " + connection.getURL();
+                switch (e.responseCode()) {
+                case HttpURLConnection.HTTP_MOVED_PERM: // 301
+                case HttpURLConnection.HTTP_MOVED_TEMP: // 302
+                    msg += " that returned location header '" + e.getLocation() + "'";
+                    break;
+                case HttpURLConnection.HTTP_UNAUTHORIZED: // 401
+                    if (authorizationPolicy == null || authorizationPolicy.getUserName()
== null) {
+                        msg += " with NO authorization username configured in conduit " +
getConduitName();
+                    } else {
+                        msg += " with authorization username '" + authorizationPolicy.getUserName()
+ "'";
+                    }
+                    break;
+                case HttpURLConnection.HTTP_PROXY_AUTH: // 407
+                    if (proxyAuthorizationPolicy == null || proxyAuthorizationPolicy.getUserName()
== null) {
+                        msg += " with NO proxy authorization configured in conduit " + getConduitName();
+                    } else {
+                        msg += " with proxy authorization username '"
+                               + proxyAuthorizationPolicy.getUserName() + "'";
+                    }
+                    if (clientSidePolicy == null || clientSidePolicy.getProxyServer() ==
null) {
+                        if (connection.usingProxy()) {
+                            msg += " using a proxy even if NONE is configured in CXF conduit
"
+                                   + getConduitName()
+                                   + " (maybe one is configured by java.net.ProxySelector)";
+                        } else {
+                            msg += " but NO proxy was used by the connection (none configured
in cxf "
+                                   + "conduit and none selected by java.net.ProxySelector)";
+                        }
+                    } else {
+                        msg += " using " + clientSidePolicy.getProxyServerType() + " proxy
"
+                               + clientSidePolicy.getProxyServer() + ":"
+                               + clientSidePolicy.getProxyServerPort();
+                    }
+                    break;
+                default:
+                    // No other type of HttpRetryException should be thrown
+                    break;
+                }
+                // pass cause with initCause() instead of constructor for jdk 1.5 compatibility
+                throw (IOException) new IOException(msg).initCause(e);
             } catch (IOException e) {
                 String url = connection.getURL().toString();
                 String origMessage = e.getMessage();



Mime
View raw message