Skip to content

Commit

Permalink
Merge pull request #12 from lendup/virtualhost-patch
Browse files Browse the repository at this point in the history
Make WS properly set virtualHost/FDC-15594
  • Loading branch information
Jacob Rosenberg committed May 5, 2016
2 parents a6d97a0 + 2ca264f commit 800a918
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions framework/src/play/libs/WS.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public static abstract class WSRequest {
public FileParam[] fileParams;
public Map<String, String> headers = new HashMap<String, String>();
public Map<String, Object> parameters = new LinkedHashMap<String, Object>();
public String virtualHost;
public String mimeType;
public boolean followRedirects = true;
/**
Expand Down Expand Up @@ -263,6 +264,11 @@ public WSRequest mimeType(String mimeType) {
this.mimeType = mimeType;
return this;
}

public WSRequest virtualHost(String virtualHost) {
this.virtualHost = virtualHost;
return this;
}

/**
* define client authentication for a server host
Expand Down
3 changes: 3 additions & 0 deletions framework/src/play/libs/ws/WSAsync.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ private BoundRequestBuilder prepare(BoundRequestBuilder builder) {
for (String key: this.headers.keySet()) {
builder.addHeader(key, headers.get(key));
}
if (this.virtualHost != null) {
builder.setVirtualHost(this.virtualHost);
}
builder.setFollowRedirects(this.followRedirects);
PerRequestConfig perRequestConfig = new PerRequestConfig();
perRequestConfig.setRequestTimeoutInMs(this.timeout * 1000);
Expand Down

0 comments on commit 800a918

Please sign in to comment.