incubator-amber-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1415134 - in /incubator/amber/trunk/oauth-2.0: client/src/main/java/org/apache/amber/oauth2/client/ client/src/main/java/org/apache/amber/oauth2/client/request/ httpclient4/src/main/java/org/apache/amber/oauth2/httpclient4/
Date Thu, 29 Nov 2012 11:55:24 GMT
Author: asanso
Date: Thu Nov 29 11:55:23 2012
New Revision: 1415134

URL: http://svn.apache.org/viewvc?rev=1415134&view=rev
Log:
AMBER-61 - Client defined HTTP headers in OAuthClientRequest

Modified:
    incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/URLConnectionClient.java
    incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java
    incubator/amber/trunk/oauth-2.0/httpclient4/src/main/java/org/apache/amber/oauth2/httpclient4/HttpClient4.java

Modified: incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/URLConnectionClient.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/URLConnectionClient.java?rev=1415134&r1=1415133&r2=1415134&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/URLConnectionClient.java
(original)
+++ incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/URLConnectionClient.java
Thu Nov 29 11:55:23 2012
@@ -71,6 +71,12 @@ public class URLConnectionClient impleme
                         httpURLConnection.addRequestProperty(header.getKey(), header.getValue());
                     }
                 }
+                
+                if (request.getHeaders() != null) {
+                    for (Map.Entry<String, String> header : request.getHeaders().entrySet())
{
+                    	httpURLConnection.addRequestProperty(header.getKey(), header.getValue());
+                    }
+                }
 
                 if (!OAuthUtils.isEmpty(requestMethod)) {
                     httpURLConnection.setRequestMethod(requestMethod);

Modified: incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java?rev=1415134&r1=1415133&r2=1415134&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java
(original)
+++ incubator/amber/trunk/oauth-2.0/client/src/main/java/org/apache/amber/oauth2/client/request/OAuthClientRequest.java
Thu Nov 29 11:55:23 2012
@@ -48,6 +48,7 @@ public class OAuthClientRequest implemen
 
     protected OAuthClientRequest(String url) {
         this.url = url;
+        this.headers=new HashMap<String, String>();
     }
 
     public static AuthenticationRequestBuilder authorizationLocation(String url) {

Modified: incubator/amber/trunk/oauth-2.0/httpclient4/src/main/java/org/apache/amber/oauth2/httpclient4/HttpClient4.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/httpclient4/src/main/java/org/apache/amber/oauth2/httpclient4/HttpClient4.java?rev=1415134&r1=1415133&r2=1415134&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/httpclient4/src/main/java/org/apache/amber/oauth2/httpclient4/HttpClient4.java
(original)
+++ incubator/amber/trunk/oauth-2.0/httpclient4/src/main/java/org/apache/amber/oauth2/httpclient4/HttpClient4.java
Thu Nov 29 11:55:23 2012
@@ -95,6 +95,11 @@ public class HttpClient4 implements Http
                     req.setHeader(header.getKey(), header.getValue());
                 }
             }
+            if (request.getHeaders() != null) {
+                for (Map.Entry<String, String> header : request.getHeaders().entrySet())
{
+                    req.setHeader(header.getKey(), header.getValue());
+                }
+            }
             HttpResponse response = client.execute(req);
             Header contentTypeHeader = null;
             HttpEntity entity = response.getEntity();



Mime
View raw message