chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1479933 - /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
Date Tue, 07 May 2013 15:06:37 GMT
Author: fmui
Date: Tue May  7 15:06:36 2013
New Revision: 1479933

URL: http://svn.apache.org/r1479933
Log:
allow clients to set a user-agent header

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java?rev=1479933&r1=1479932&r2=1479933&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
Tue May  7 15:06:36 2013
@@ -117,9 +117,16 @@ public class DefaultHttpInvoker implemen
                 Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(url.toString());
                 if (httpHeaders != null) {
                     for (Map.Entry<String, List<String>> header : httpHeaders.entrySet())
{
-                        if (header.getValue() != null) {
-                            for (String value : header.getValue()) {
-                                conn.addRequestProperty(header.getKey(), value);
+                        if (header.getKey() != null && header.getValue() != null
&& !header.getValue().isEmpty()) {
+                            String key = header.getKey();
+                            if (key.equalsIgnoreCase("user-agent")) {
+                                conn.setRequestProperty("User-Agent", header.getValue().get(0));
+                            } else {
+                                for (String value : header.getValue()) {
+                                    if (value != null) {
+                                        conn.addRequestProperty(key, value);
+                                    }
+                                }
                             }
                         }
                     }



Mime
View raw message