Skip to content

Commit 2828ad0

Browse files
authored
Merge pull request #58 from SparkPost/feature/httpclient_4_5_3_compat_issue57
Feature/httpclient 4 5 3 compat issue57
2 parents b7fcbf4 + a183530 commit 2828ad0

File tree

56 files changed

+1727
-275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1727
-275
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Use this library in Java applications to easily access the SparkPost Email API i
1010

1111
## Version Compatibility Note
1212

13+
### Version 0.6.2 -> 0.6.3
14+
15+
Due to [issue 57](https://github.com/SparkPost/java-sparkpost/issues/57) and to maintain compatibility with old and new version of Apache HTTP Client `SPARKPOST_BASE_URL` must not end with a `/` slash.
16+
1317
### Version 0.12 -> 0.13
1418

1519
Although we try to maintain library backward compatibility this migration may require some minor changes to your code. Substitution data was changed from `Map<String, String>` to `Map<String, Object>`. Most client code will just need to change their map to this new signature.
@@ -23,7 +27,7 @@ The SparkPost Java Library is available in this [Maven Repository](http://maven.
2327
<dependency>
2428
<groupId>com.sparkpost</groupId>
2529
<artifactId>sparkpost-lib</artifactId>
26-
<version>0.16.2</version>
30+
<version>0.17</version>
2731
</dependency>
2832
```
2933

apps/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>com.sparkpost</groupId>
55
<artifactId>sparkpost</artifactId>
6-
<version>0.16.2</version>
6+
<version>0.17</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>apps</artifactId>

apps/sparkpost-documentor-app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.sparkpost</groupId>
66
<artifactId>apps</artifactId>
7-
<version>0.16.2</version>
7+
<version>0.17</version>
88
</parent>
99
<artifactId>sparkpost-documentor-app</artifactId>
1010
<name>Generates Markdown of Protocol</name>

apps/sparkpost-javamail-app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.sparkpost</groupId>
88
<artifactId>apps</artifactId>
9-
<version>0.16.2</version>
9+
<version>0.17</version>
1010
</parent>
1111
<groupId>com.sparkpost.sample</groupId>
1212
<artifactId>sparkpost-javamail-app</artifactId>

apps/sparkpost-javamail-app/src/main/java/com/sparkpost/sample/App.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.sparkpost.model.responses.Response;
3333
import com.sparkpost.resources.ResourceTransmissions;
3434
import com.sparkpost.sample.helpers.SparkPostBaseApp;
35+
import com.sparkpost.transport.IRestConnection;
3536
import com.sparkpost.transport.RestConnection;
3637

3738
/**
@@ -96,7 +97,7 @@ private void sendEmail(String from, String[] recipients, String email) throws Sp
9697
transmission.setContentAttributes(contentAttributes);
9798

9899
// Send the Email
99-
RestConnection connection = new RestConnection(sparkpostClient, getEndPoint());
100+
IRestConnection connection = new RestConnection(sparkpostClient, getEndPoint());
100101

101102
Response response = ResourceTransmissions.create(connection, 0, transmission);
102103
if (response.getResponseCode() == 200) {

apps/sparkpost-javamail-app/src/main/java/com/sparkpost/sample/helpers/SparkPostBaseApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import com.sparkpost.Client;
1616
import com.sparkpost.exception.SparkPostException;
17-
import com.sparkpost.transport.RestConnection;
17+
import com.sparkpost.transport.IRestConnection;
1818

1919
/**
2020
* A simple class to setup up the SparkPost client with the API KEY from a property file.
@@ -52,7 +52,7 @@ protected Client newConfiguredClient() throws SparkPostException, IOException {
5252
}
5353

5454
public String getEndPoint() {
55-
String endpoint = this.properties.getProperty("SPARKPOST_BASE_URL", RestConnection.defaultApiEndpoint);
55+
String endpoint = this.properties.getProperty("SPARKPOST_BASE_URL", IRestConnection.defaultApiEndpoint);
5656

5757
return endpoint;
5858
}

apps/sparkpost-samples-app/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.sparkpost</groupId>
66
<artifactId>apps</artifactId>
7-
<version>0.16.2</version>
7+
<version>0.17</version>
88
</parent>
99
<artifactId>sparkpost-samples-app</artifactId>
1010
<name>Example use SparkPost library</name>

apps/sparkpost-samples-app/src/main/java/com/sparkpost/error/samples/BadApiKeyErrorSample.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.sparkpost.exception.SparkPostException;
1212
import com.sparkpost.resources.ResourceSendingDomains;
1313
import com.sparkpost.sdk.samples.helpers.SparkPostBaseApp;
14+
import com.sparkpost.transport.IRestConnection;
1415
import com.sparkpost.transport.RestConnection;
1516

1617
/**
@@ -32,7 +33,7 @@ public static void main(String[] args) throws SparkPostException, IOException {
3233
private void runApp() throws SparkPostException, IOException {
3334
this.client = this.newConfiguredClient();
3435
this.client.setAuthKey("This_is_a_bad_api_key");
35-
RestConnection connection = new RestConnection(this.client, getEndPoint());
36+
IRestConnection connection = new RestConnection(this.client, getEndPoint());
3637
try {
3738
ResourceSendingDomains.list(connection);
3839

apps/sparkpost-samples-app/src/main/java/com/sparkpost/error/samples/ForceTransportError.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.sparkpost.model.Webhook;
1313
import com.sparkpost.resources.ResourceWebhooks;
1414
import com.sparkpost.sdk.samples.helpers.SparkPostBaseApp;
15+
import com.sparkpost.transport.IRestConnection;
1516
import com.sparkpost.transport.RestConnection;
1617

1718
public class ForceTransportError extends SparkPostBaseApp {
@@ -41,7 +42,7 @@ private void runApp() throws SparkPostException, IOException {
4142
private void foceFourHundredError() throws SparkPostException, IOException {
4243
this.client = this.newConfiguredClient();
4344

44-
RestConnection restConnection = new RestConnection(this.client);
45+
IRestConnection restConnection = new RestConnection(this.client);
4546
Webhook webhook = new Webhook();
4647
webhook.setName("name with spaces");
4748
try {

apps/sparkpost-samples-app/src/main/java/com/sparkpost/error/samples/SendEmailErrorSample.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.sparkpost.model.responses.ServerErrorResponse;
2121
import com.sparkpost.resources.ResourceTransmissions;
2222
import com.sparkpost.sdk.samples.helpers.SparkPostBaseApp;
23+
import com.sparkpost.transport.IRestConnection;
2324
import com.sparkpost.transport.RestConnection;
2425

2526
public class SendEmailErrorSample extends SparkPostBaseApp {
@@ -78,7 +79,7 @@ private void sendEmail(String from, String[] recipients) throws SparkPostExcepti
7879
transmission.setContentAttributes(contentAttributes);
7980

8081
// Send the Email
81-
RestConnection connection = new RestConnection(this.client, getEndPoint());
82+
IRestConnection connection = new RestConnection(this.client, getEndPoint());
8283

8384
try {
8485

0 commit comments

Comments
 (0)