cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r743439 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/version/ rt/transports/http/src/main/java/org/apache/cxf/transport/http/ rt/transports/http/src/test/java/org/apache/cxf/transport/http/
Date Wed, 11 Feb 2009 18:21:48 GMT
Author: dkulp
Date: Wed Feb 11 18:21:47 2009
New Revision: 743439

URL: http://svn.apache.org/viewvc?rev=743439&view=rev
Log:
Set the User-Agent on the HTTP connection

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/version/Version.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/version/Version.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/version/Version.java?rev=743439&r1=743438&r2=743439&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/version/Version.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/version/Version.java Wed Feb 11 18:21:47
2009
@@ -26,6 +26,7 @@
 
     private static String version;
     private static String name;
+    private static String fullVersion;
     
     private static final String VERSION_BASE = "/org/apache/cxf/version/";
 
@@ -56,6 +57,7 @@
 
             version = p.getProperty("product.version", "<unknown>");
             name = p.getProperty("product.name", "Apache CXF");
+            fullVersion = name + " " + version;
         }
     }
 
@@ -75,6 +77,6 @@
      */
     public static String getCompleteVersionString() {
         loadProperties();
-        return name + " " + version;
+        return fullVersion;
     }
 }

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=743439&r1=743438&r2=743439&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
Wed Feb 11 18:21:47 2009
@@ -66,6 +66,7 @@
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.http.policy.PolicyUtils;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.version.Version;
 import org.apache.cxf.workqueue.AutomaticWorkQueue;
 import org.apache.cxf.workqueue.WorkQueueManager;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
@@ -823,6 +824,9 @@
                 connection.addRequestProperty(header, value);
             }
         }
+        if (!connection.getRequestProperties().containsKey("User-Agent")) {
+            connection.addRequestProperty("User-Agent", Version.getCompleteVersionString());
+        }
     }
     
     /**
@@ -1177,7 +1181,7 @@
             headers.put("Accept",
                         createMutableList(policy.getAccept()));
         } else {
-            headers.put("Accept", createMutableList("*"));
+            headers.put("Accept", createMutableList("*/*"));
         }
         if (policy.isSetAcceptEncoding()) {
             headers.put("Accept-Encoding",

Modified: cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java?rev=743439&r1=743438&r2=743439&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
(original)
+++ cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitURLEasyMockTest.java
Wed Feb 11 18:21:47 2009
@@ -351,8 +351,8 @@
             connectionFactory.createConnection(
                                       EasyMock.eq(proxy), 
                                       EasyMock.eq(new URL(NOWHERE + "bar/foo")));
-            
             EasyMock.expectLastCall().andReturn(connection);
+
             connection.setDoOutput(true);
             EasyMock.expectLastCall();
             
@@ -507,7 +507,7 @@
         wrappedOS.flush();
         wrappedOS.flush();
         wrappedOS.close();
-        
+
         assertNotNull("expected in message", inMessage);
         Map<?, ?> headerMap = (Map<?, ?>) inMessage.get(Message.PROTOCOL_HEADERS);
         assertEquals("unexpected response headers", headerMap.size(), 0);
@@ -562,6 +562,8 @@
                                           EasyMock.eq("charset=utf8"));
             EasyMock.expectLastCall();
         }
+        connection.getRequestProperties();
+        EasyMock.expectLastCall().andReturn(new HashMap<String, List<String>>()).anyTimes();
         
         control.replay();
         



Mime
View raw message