Skip to content

Commit

Permalink
Make WS properly set virtualHost
Browse files Browse the repository at this point in the history
  • Loading branch information
phyous authored and avinson committed Apr 12, 2016
1 parent a6d97a0 commit 2ca264f
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 2ca264f

Please sign in to comment.