Permalink
Browse files

[#1435] Fix Non Proxy Hosts for WS.get() call

  • Loading branch information...
1 parent 502581d commit 4a60c90031f485827871e94fd7a0e8746cd2b767 @xflash xflash committed with mbknor Feb 17, 2012
Showing with 20 additions and 1 deletion.
  1. +12 −0 documentation/manual/configuration.textile
  2. +8 −1 framework/src/play/libs/ws/WSAsync.java
@@ -474,6 +474,18 @@ Proxy user for web services requests.
Default: @http.proxyUser@ system property.
+h3(#http.nonProxyHosts). http.nonProxyHosts
+
+Indicates the hosts which should be connected to directly and not through the proxy server.
+The value can be a list of hosts, each seperated by a @|@, and in addition a wildcard character @*@ can be used for matching.
+
+For example:
+
+bc. http.nonProxyHosts=localhost|*.example.com
+
+Default: @http.nonProxyHosts@ system property.
+
+
h3(#http.useETag). http.useETag
@@ -58,6 +58,7 @@ public WSAsync() {
String proxyPort = Play.configuration.getProperty("http.proxyPort", System.getProperty("http.proxyPort"));
String proxyUser = Play.configuration.getProperty("http.proxyUser", System.getProperty("http.proxyUser"));
String proxyPassword = Play.configuration.getProperty("http.proxyPassword", System.getProperty("http.proxyPassword"));
+ String nonProxyHosts = Play.configuration.getProperty("http.nonProxyHosts", System.getProperty("http.nonProxyHosts"));
String userAgent = Play.configuration.getProperty("http.userAgent");
Builder confBuilder = new AsyncHttpClientConfig.Builder();
@@ -70,6 +71,12 @@ public WSAsync() {
throw new IllegalStateException("WS proxy is misconfigured -- check the logs for details");
}
ProxyServer proxy = new ProxyServer(proxyHost, proxyPortInt, proxyUser, proxyPassword);
+ if (nonProxyHosts != null) {
+ final String[] strings = nonProxyHosts.split("\\|");
+ for (String uril : strings) {
+ proxy.addNonProxyHost(uril);
+ }
+ }
confBuilder.setProxyServer(proxy);
}
if (userAgent != null) {
@@ -540,7 +547,7 @@ private void addGeneratedContentType(BoundRequestBuilder requestBuilder) {
/**
* you shouldnt have to create an HttpResponse yourself
- * @param method
+ * @param response
*/
public HttpAsyncResponse(Response response) {
this.response = response;

0 comments on commit 4a60c90

Please sign in to comment.