Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class SprinterApi extends RestApi {
this.BASE_URL = "https://sprint.ly/api/";
this.urlSuffix = ".json";
this.rest.setHost("sprint.ly");
this.rest.setPort(80);
this.setUserAgent("sprinter");

this.acceptAllSslCertificates();
Expand Down
9 changes: 7 additions & 2 deletions com/manavo/rest/RestRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class RestRequest {
private String username;
private String password;
private String host;
private int port;
private Handler handler;
private ExecuteAsyncRequest asyncTask;

Expand Down Expand Up @@ -113,6 +114,10 @@ public void setHandler(Handler handler) {
public void setHost(String host) {
this.host = host;
}

public void setPort(int port) {
this.port = port;
}

public void setSsl(boolean ssl) {
this.useSsl = ssl;
Expand Down Expand Up @@ -234,7 +239,7 @@ private Bundle executeRequest(HttpRequest request) {

HttpHost targetHost;
if (this.useSsl == false) {
targetHost = new HttpHost(this.host, 80, "http");
targetHost = new HttpHost(this.host, this.port, "http");
} else {
targetHost = new HttpHost(this.host, 443, "https");
}
Expand Down Expand Up @@ -316,7 +321,7 @@ private DefaultHttpClient getNewHttpClient() {
HttpConnectionParams.setSoTimeout(params, timeoutSocket);

SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), this.port));
registry.register(new Scheme("https", sf, 443));

ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
Expand Down