You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2019/02/17 14:29:44 UTC
[httpcomponents-core] branch master updated: Add a "quiet" option
to AsyncReverseProxyExample.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
The following commit(s) were added to refs/heads/master by this push:
new 2c03d0b Add a "quiet" option to AsyncReverseProxyExample.
2c03d0b is described below
commit 2c03d0b9307150cf97a95b22a906bbe9b9210f8e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 17 09:29:42 2019 -0500
Add a "quiet" option to AsyncReverseProxyExample.
---
.../hc/core5/http/examples/AsyncReverseProxyExample.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index aded0f3..d41311c 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -88,9 +88,11 @@ import org.apache.hc.core5.util.Timeout;
*/
public class AsyncReverseProxyExample {
+ private static boolean quiet;
+
public static void main(final String[] args) throws Exception {
if (args.length < 1) {
- System.out.println("Usage: <hostname[:port]> [listener port]");
+ System.out.println("Usage: <hostname[:port]> [listener port] [--quiet]");
System.exit(1);
}
// Target host
@@ -99,6 +101,12 @@ public class AsyncReverseProxyExample {
if (args.length > 1) {
port = Integer.parseInt(args[1]);
}
+ for (final String s : args) {
+ if ("--quiet".equalsIgnoreCase(s)) {
+ quiet = true;
+ break;
+ }
+ }
println("Reverse proxy to " + targetHost);
@@ -689,6 +697,8 @@ public class AsyncReverseProxyExample {
}
static final void println(final String msg) {
- System.out.println(HttpDateGenerator.INSTANCE.getCurrentDate() + " | " + msg);
+ if (!quiet) {
+ System.out.println(HttpDateGenerator.INSTANCE.getCurrentDate() + " | " + msg);
+ }
}
}