Skip to content

Commit

Permalink
Modifies to use secure connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Thorley authored and EsendexDev committed Feb 3, 2016
1 parent 19eec39 commit 2d5b117
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import esendex.sdk.java.model.domain.impl.TemplateField;

import java.util.ArrayList;
import java.util.List;

public class RecipientRequest {

private String phonenumber;
private List<TemplateField> templateFields;
private List<TemplateField> templateFields = new ArrayList<TemplateField>();

/**
* @param phonenumber the phone number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected String getRequestData() {
}

public BaseSurveysResource(Authenticator auth, String id, HttpQuery query, String version) {
super(auth, id, query, version, props.getProperty(EsendexProperties.Key.SURVEYS_DOMAIN));
super(auth, id, query, version, props.getProperty(EsendexProperties.Key.SURVEYS_DOMAIN), true);

}
}
12 changes: 10 additions & 2 deletions src/main/java/esendex/sdk/java/service/resource/base/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public abstract class Resource {

private static final Log log = LogFactory.getLog(Resource.class);
private boolean secure;

private String domain;
private String version;
Expand All @@ -36,18 +37,22 @@ public abstract class Resource {
private String baseUrl;
private Authenticator authenticator;

public Resource(Authenticator auth, String id, HttpQuery query, String version, String domain) {


public Resource(Authenticator auth, String id, HttpQuery query, String version, String domain, boolean secure) {

this.id = id;
this.query = query;
this.authenticator = auth;
this.version = version;
this.domain = domain;
this.secure = secure;
baseUrl = createParentEndpoint(domain);
}

public Resource(Authenticator auth, String account, String id, HttpQuery query, String version) {

this.secure = false;
this.account = account;
this.id = id;
this.query = query;
Expand Down Expand Up @@ -78,7 +83,10 @@ private String createParentEndpoint(String domain) {
EsendexProperties props = EsendexProperties.instance();
StringBuilder builder = new StringBuilder();

builder.append("http://");
if(secure)
builder.append("https://");
else
builder.append("http://");

if(this.domain != null)
builder.append(domain);
Expand Down

0 comments on commit 2d5b117

Please sign in to comment.