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:14 UTC

[httpcomponents-core] branch AsyncReverseProxyExample-quiet created (now c1c637c)

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

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


      at c1c637c  Add a "quiet" option to AsyncReverseProxyExample.

This branch includes the following new commits:

     new c1c637c  Add a "quiet" option to AsyncReverseProxyExample.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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

Posted by gg...@apache.org.
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);
+        }
     }
 }