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/16 13:42:15 UTC

[httpcomponents-core] 01/01: Add a "quiet" option to AsyncReverseProxyExample.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch AsyncReverseProxyExample-quiet
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit c1c637c6ed655bce9a1343c9a3cfb308601c2dd7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Feb 16 08:42:08 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);
+        }
     }
 }