Permalink
Browse files

Merge pull request #18 from 3ft9/current

Added the User-Agent header to the StreamConsumer implementations.
  • Loading branch information...
2 parents 82edb87 + 0a11be8 commit 4414847c19f4db71ab9b5c4f0977a7b6b95ecfcd @quipo quipo committed Mar 13, 2012
View
@@ -9,6 +9,8 @@ The unit tests should be run with junit.
All examples and tests use the username and API key in Config.java.
+Download the JAR file at https://github.com/datasift/datasift-java/downloads
+
Requirements
------------
@@ -31,6 +33,8 @@ more details.
Changelog
---------
+* v.1.3.2 Added User-Agent header to the StreamConsumers (2012-03-13)
+
* v.1.3.1 Do not reconnect when a 4xx response is received (2012-03-08)
* v.1.3.0 Stream warning/error handling + WS disconnection changes (2012-03-08)
View
@@ -4,7 +4,7 @@
<property name="deploy.dir" value="../deploy"/>
<property name="classes.dir" value="../deploy/classes"/>
- <property name="version" value="1.3.1"/>
+ <property name="version" value="1.3.2"/>
<path id="class.path">
<fileset dir="../lib">
View
@@ -7,7 +7,7 @@
<groupId>com.mediasift</groupId>
<artifactId>datasift-java</artifactId>
<packaging>jar</packaging>
- <version>1.3.1</version>
+ <version>1.3.2</version>
<name>DataSift Java Client library</name>
<description>A client library for interacting with the DataSift API on the JVM.</description>
@@ -113,7 +113,8 @@ public void run() {
+ _user.getStreamBaseURL() + "multi?hashes=" + _hashes.toString().replace(", ", ",").replace("[", "").replace("]", "");
HttpGet get = new HttpGet(url);
try {
- get.addHeader("authorization", _user.getUsername() + ":" + _user.getAPIKey());
+ get.addHeader("Authorization", _user.getUsername() + ":" + _user.getAPIKey());
+ get.addHeader("User-Agent", _user.getUserAgent());
HttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
@@ -100,7 +100,8 @@ public void run() {
HttpGet get = new HttpGet("http://"
+ _user.getStreamBaseURL() + _definition.getHash());
try {
- get.addHeader("authorization", _user.getUsername() + ":" + _user.getAPIKey());
+ get.addHeader("Authorization", _user.getUsername() + ":" + _user.getAPIKey());
+ get.addHeader("User-Agent", _user.getUserAgent());
HttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == 200) {
@@ -33,6 +33,7 @@ public WSThread(WS http, User user) throws WebSocketException, URISyntaxExceptio
_ws = new WebSocketConnection(new URI("ws://" + _user.getStreamBaseURL()));
_ws.addHeader("Authorization: " + _user.getUsername() + ":" + _user.getAPIKey());
+ _ws.addHeader("User-Agent: " + _user.getUserAgent());
}
public void setAutoReconnect(boolean auto_reconnect) {

0 comments on commit 4414847

Please sign in to comment.