Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Added the User-Agent header to the StreamConsumer implementations.
Browse files Browse the repository at this point in the history
Bumped version to 1.3.2.
  • Loading branch information
Stuart Dallas committed Mar 13, 2012
1 parent e811fba commit e5d2e93
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -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
------------

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build/build.xml
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion src/org/datasift/streamconsumer/HttpMultiThread.java
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/org/datasift/streamconsumer/HttpThread.java
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/org/datasift/streamconsumer/WSThread.java
Expand Up @@ -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) {
Expand Down

0 comments on commit e5d2e93

Please sign in to comment.