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

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 7197acf  Context API refactoring.
7197acf is described below

commit 7197acf09bc7fa418b8725e6ed450c08223a5c77
Author: JamesBognar <[email protected]>
AuthorDate: Fri Sep 24 10:46:36 2021 -0400

    Context API refactoring.
---
 .../java/org/apache/juneau/cp/BeanCreator.java     |  17 +-
 .../org/apache/juneau/httppart/HttpPartParser.java |  12 ++
 .../apache/juneau/httppart/HttpPartSerializer.java |  12 ++
 .../apache/juneau/mstat/ThrownStatsBuilder.java    |  29 +---
 .../java/org/apache/juneau/mstat/ThrownStore.java  |   2 +-
 .../juneau/rest/client/BasicRestCallHandler.java   |   2 +-
 .../apache/juneau/rest/client/RestCallHandler.java |   8 +-
 .../org/apache/juneau/rest/client/RestClient.java  |  60 +------
 .../juneau/rest/client/RestClientBuilder.java      | 174 +++++++++++----------
 .../juneau/rest/mock/MockRestClientBuilder.java    |   6 -
 .../client/RestClient_Config_RestClient_Test.java  |   2 +-
 11 files changed, 151 insertions(+), 173 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
index 4f7d0a8..313d5c4 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/cp/BeanCreator.java
@@ -26,7 +26,7 @@ import org.apache.juneau.reflect.*;
 
 /**
  * Utility class for creating beans.
- * 
+ *
  * @param <T> The bean type being created.
  */
 public class BeanCreator<T> {
@@ -36,6 +36,7 @@ public class BeanCreator<T> {
        private Object outer;
        private Object builder;
        private boolean findSingleton;
+       private T impl;
 
        /**
         * Static creator.
@@ -70,6 +71,16 @@ public class BeanCreator<T> {
        }
 
        /**
+        * Allows you to specify a specific instance for the build method to 
return.
+        *
+        * @param value The value for this setting.
+        * @return This object.
+        */
+       public BeanCreator<T> impl(T value) {
+               impl = value;
+               return this;
+       }
+       /**
         * Specifies a bean store for looking up matching parameters on 
constructors and static creator methods.
         *
         * @param value The value for this setting.
@@ -119,6 +130,10 @@ public class BeanCreator<T> {
         * @return A new bean.
         */
        public T run() {
+
+               if (impl != null)
+                       return impl;
+
                if (type == null)
                        return null;
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
index 30b1893..eda480a 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartParser.java
@@ -34,6 +34,10 @@ import org.apache.juneau.parser.*;
  */
 public interface HttpPartParser {
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Static
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * Represent "no" part parser.
         *
@@ -50,6 +54,10 @@ public interface HttpPartParser {
                return new Creator();
        }
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Creator
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * A creator for a part parser.
         */
@@ -80,6 +88,10 @@ public interface HttpPartParser {
                }
        }
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Instance
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * Creates a new parser session.
         *
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
index a910f47..14ad80a 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/httppart/HttpPartSerializer.java
@@ -46,6 +46,10 @@ import org.apache.juneau.serializer.*;
  */
 public interface HttpPartSerializer {
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Static
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * Represent "no" part part serializer.
         *
@@ -62,6 +66,10 @@ public interface HttpPartSerializer {
                return new Creator();
        }
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Creator
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * A creator for a part serializer.
         */
@@ -93,6 +101,10 @@ public interface HttpPartSerializer {
                }
        }
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Instance
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * Creates a new serializer session.
         *
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStatsBuilder.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStatsBuilder.java
index dad37bb..03fdde1 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStatsBuilder.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStatsBuilder.java
@@ -12,12 +12,8 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.mstat;
 
-import static org.apache.juneau.internal.ClassUtils.*;
-import static org.apache.juneau.internal.ExceptionUtils.*;
-
 import java.util.*;
 
-import org.apache.juneau.*;
 import org.apache.juneau.cp.*;
 import org.apache.juneau.internal.*;
 
@@ -32,8 +28,7 @@ public class ThrownStatsBuilder {
        List<String> stackTrace;
        ThrownStats causedBy;
 
-       Class<? extends ThrownStats> implClass;
-       BeanStore beanStore;
+       BeanCreator<ThrownStats> creator = 
BeanCreator.create(ThrownStats.class).builder(this);
 
        /**
         * Create a new {@link ThrownStats} using this builder.
@@ -41,21 +36,7 @@ public class ThrownStatsBuilder {
         * @return A new {@link ThrownStats}
         */
        public ThrownStats build() {
-               try {
-                       Class<? extends ThrownStats> ic = isConcrete(implClass) 
? implClass : getDefaultImplClass();
-                       return 
BeanCreator.create(ic).store(beanStore).builder(this).run();
-               } catch (ExecutableException e) {
-                       throw runtimeException(e);
-               }
-       }
-
-       /**
-        * Specifies the default implementation class if not specified via 
{@link #implClass(Class)}.
-        *
-        * @return The default implementation class if not specified via {@link 
#implClass(Class)}.
-        */
-       protected Class<? extends ThrownStats> getDefaultImplClass() {
-               return ThrownStats.class;
+               return creator.run();
        }
 
        /**
@@ -69,7 +50,7 @@ public class ThrownStatsBuilder {
         */
        @FluentSetter
        public ThrownStatsBuilder beanStore(BeanStore value) {
-               this.beanStore = value;
+               creator.store(value);
                return this;
        }
 
@@ -80,8 +61,8 @@ public class ThrownStatsBuilder {
         * @return  This object (for method chaining).
         */
        @FluentSetter
-       public ThrownStatsBuilder implClass(Class<? extends ThrownStats> value) 
{
-               this.implClass = value;
+       public ThrownStatsBuilder type(Class<? extends ThrownStats> value) {
+               creator.type(value == null ? ThrownStats.class : value);
                return this;
        }
 
diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStore.java
 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStore.java
index 28a2d95..dd13081 100644
--- 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStore.java
+++ 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/mstat/ThrownStore.java
@@ -335,7 +335,7 @@ public class ThrownStore {
                        stc = ThrownStats
                                .create()
                                .beanStore(beanStore)
-                               .implClass(statsImplClass)
+                               .type(statsImplClass)
                                .throwable(t)
                                .hash(hash)
                                .stackTrace(createStackTrace(t))
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/BasicRestCallHandler.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/BasicRestCallHandler.java
index 76cfb0d..44aff2b 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/BasicRestCallHandler.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/BasicRestCallHandler.java
@@ -21,7 +21,7 @@ import org.apache.http.protocol.*;
 /**
  * Default HTTP call handler.
  *
- * Can be subclasses and specified via {@link 
RestClient#RESTCLIENT_callHandler}.
+ * Can be subclasses and specified via {@link RestClientBuilder#callHandler()}.
  */
 public class BasicRestCallHandler implements RestCallHandler {
 
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCallHandler.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCallHandler.java
index 7e5e9af..56239cc 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCallHandler.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestCallHandler.java
@@ -58,13 +58,15 @@ import org.apache.juneau.*;
  * </p>
  *
  * <ul class='seealso'>
- *     <li class='jf'>{@link RestClient#RESTCLIENT_callHandler}
- *     <li class='jm'>{@link RestClientBuilder#callHandler(Class)}
- *     <li class='jm'>{@link RestClientBuilder#callHandler(RestCallHandler)}
+ *     <li class='jm'>{@link RestClientBuilder#callHandler()}
  * </ul>
  */
 public interface RestCallHandler {
 
+       
//-----------------------------------------------------------------------------------------------------------------
+       // Instance
+       
//-----------------------------------------------------------------------------------------------------------------
+
        /**
         * Execute the specified request.
         *
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index a3809f8..bff27d3 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -771,8 +771,7 @@ import org.apache.juneau.utils.*;
  * <ul class='javatree'>
  *     <li class='jc'>{@link RestClientBuilder}
  *     <ul>
- *             <li class='jm'>{@link RestClientBuilder#callHandler(Class) 
callHandler(Class&lt;? extends RestCallHandler&gt;)}
- *             <li class='jm'>{@link 
RestClientBuilder#callHandler(RestCallHandler) callHandler(RestCallHandler)}
+ *             <li class='jm'>{@link RestClientBuilder#callHandler() 
callHandler()}
  *     </ul>
  *     <li class='jic'>{@link RestCallHandler}
  *     <ul>
@@ -1022,49 +1021,6 @@ public class RestClient extends BeanContextable 
implements HttpClient, Closeable
        private static final String PREFIX = "RestClient.";
 
        /**
-        * Configuration property:  REST call handler.
-        *
-        * <h5 class='section'>Property:</h5>
-        * <ul class='spaced-list'>
-        *      <li><b>ID:</b>  {@link 
org.apache.juneau.rest.client.RestClient#RESTCLIENT_callHandler 
RESTCLIENT_callHandler}
-        *      <li><b>Name:</b>  <js>"RestClient.callHandler.o"</js>
-        *      <li><b>Data type:</b>
-        *              <ul>
-        *                      <li><c>Class&lt;? <jk>extends</jk> {@link 
org.apache.juneau.rest.client.RestCallHandler}&gt;</c>
-        *                      <li>{@link 
org.apache.juneau.rest.client.RestCallHandler}
-        *              </ul>
-        *      <li><b>Default:</b>  <c><jk>null</jk></c>
-        *      <li><b>Methods:</b>
-        *              <ul>
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.client.RestClientBuilder#callHandler(Class)}
-        *                      <li class='jm'>{@link 
org.apache.juneau.rest.client.RestClientBuilder#callHandler(RestCallHandler)}
-        *              </ul>
-        * </ul>
-        *
-        * <h5 class='section'>Description:</h5>
-        *
-        * <p>
-        * Allows you to provide a custom handler for making HTTP calls.
-        *
-        * <h5 class='section'>Example:</h5>
-        * <p class='bcode w800'>
-        *      <jc>// Create a client that handles processing of requests 
using a custom handler.</jc>
-        *      RestClient <jv>client</jv> = RestClient
-        *              .<jsm>create</jsm>()
-        *              .callHandler(
-        *                      <jk>new</jk> RestCallHandler() {
-        *                              <ja>@Override</ja>
-        *                              <jk>public</jk> HttpResponse 
run(HttpHost <jv>target</jv>, HttpRequest <jv>request</jv>, HttpContext 
<jv>context</jv>) <jk>throws</jk> IOException {
-        *                                      <jc>// Custom handle 
requests.</jc>
-        *                              }
-        *                      }
-        *              )
-        *              .build();
-        * </p>
-        */
-       public static final String RESTCLIENT_callHandler = PREFIX + 
"callHandler.o";
-
-       /**
         * Configuration property:  Connection manager
         *
         * <h5 class='section'>Property:</h5>
@@ -1638,11 +1594,15 @@ public class RestClient extends BeanContextable 
implements HttpClient, Closeable
        public RestClient(RestClientBuilder builder) {
                super(builder);
 
+               beanStore = builder.beanStore
+                       .addBean(RestClient.class, this);
+
                httpClient = builder.getHttpClient();
                headerData = builder.headerData().build().copy();
                queryData = builder.queryData().build().copy();
                formData = builder.formData().build().copy();
                pathData = builder.pathData().build().copy();
+               callHandler = builder.callHandler().run();
                skipEmptyHeaderData = builder.skipEmptyHeaderData;
                skipEmptyQueryData = builder.skipEmptyQueryData;
                skipEmptyFormData = builder.skipEmptyFormData;
@@ -1651,9 +1611,7 @@ public class RestClient extends BeanContextable 
implements HttpClient, Closeable
 
                ContextProperties cp = 
getContextProperties().copy().apply(getBeanContext().getContextProperties()).build();
 
-               BeanStore bs = this.beanStore = BeanStore.create().build()
-                       .addBean(ContextProperties.class, cp)
-                       .addBean(RestClient.class, this);
+               beanStore.addBean(ContextProperties.class, cp);
 
                this.connectionManager = 
cp.getInstance(RESTCLIENT_connectionManager, 
HttpClientConnectionManager.class).orElse(null);
                this.keepHttpClientOpen = 
cp.getBoolean(RESTCLIENT_keepHttpClientOpen).orElse(false);
@@ -1678,8 +1636,6 @@ public class RestClient extends BeanContextable 
implements HttpClient, Closeable
 
                this.executorService = 
cp.getInstance(RESTCLIENT_executorService, ExecutorService.class).orElse(null);
 
-               this.callHandler = cp.getInstance(RESTCLIENT_callHandler, 
RestCallHandler.class, 
bs).orElseGet(bs.creator(BasicRestCallHandler.class).supplier());
-
                this.interceptors = 
cp.getInstanceArray(RESTCLIENT_interceptors, 
RestCallInterceptor.class).orElse(new RestCallInterceptor[0]);
 
                creationStack = isDebug() ? 
Thread.currentThread().getStackTrace() : null;
@@ -1729,9 +1685,7 @@ public class RestClient extends BeanContextable 
implements HttpClient, Closeable
         * The behavior of this method can also be modified by specifying a 
different {@link RestCallHandler}.
         *
         * <ul class='seealso'>
-        *      <li class='jf'>{@link RestClient#RESTCLIENT_callHandler}
-        *      <li class='jm'>{@link RestClientBuilder#callHandler(Class)}
-        *      <li class='jm'>{@link 
RestClientBuilder#callHandler(RestCallHandler)}
+        *      <li class='jm'>{@link RestClientBuilder#callHandler()}
         * </ul>
         *
         * @param target The target host for the request.
diff --git 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
index d0515d1..cd2e1f5 100644
--- 
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
+++ 
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
@@ -48,6 +48,7 @@ import org.apache.http.impl.conn.*;
 import org.apache.http.protocol.*;
 import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
+import org.apache.juneau.cp.*;
 import org.apache.juneau.html.*;
 import org.apache.juneau.http.annotation.*;
 import org.apache.juneau.http.header.*;
@@ -91,11 +92,15 @@ import org.apache.juneau.xml.*;
 @FluentSetters(ignore={"beanMapPutReturnsOldValue","example","exampleJson"})
 public class RestClientBuilder extends BeanContextableBuilder {
 
+       BeanStore beanStore = BeanStore.create().build();
+
        private HttpClientBuilder httpClientBuilder;
        private CloseableHttpClient httpClient;
 
        private HeaderList.Builder headerData;
        private PartList.Builder queryData, formData, pathData;
+       private BeanCreator<RestCallHandler> callHandler;
+//     private RestCallHandler.Builder restCallHandler;
        private boolean pooled;
 
        String rootUri;
@@ -1912,6 +1917,92 @@ public class RestClientBuilder extends 
BeanContextableBuilder {
        }
 
        
//------------------------------------------------------------------------------------------------------------------
+       // callHandler
+       
//------------------------------------------------------------------------------------------------------------------
+
+       /**
+        * Returns the creator for the rest call handler.
+        *
+        * <p>
+        * Allows you to provide a custom handler for making HTTP calls.
+        *
+        * <h5 class='section'>Example:</h5>
+        * <p class='bcode w800'>
+        *      <jc>// Create a client that handles processing of requests 
using a custom handler.</jc>
+        *      <jk>public class</jk> MyRestCallHandler <jk>implements</jk> 
RestCallHandler {
+        *
+        *              <ja>@Override</ja>
+        *              <jk>public</jk> HttpResponse run(HttpHost 
<jv>target</jv>, HttpRequest <jv>request</jv>, HttpContext <jv>context</jv>) 
<jk>throws</jk> IOException {
+        *                      <jc>// Custom handle requests.</jc>
+        *              }
+        *      }
+        *
+        *      RestClient <jv>client</jv> = RestClient
+        *              .<jsm>create</jsm>()
+        *              .callHandler(MyRestCallHandler.<jk>class</jk>)
+        *              .build();
+        * </p>
+        *
+        * <ul class='notes'>
+        *      <li>
+        *              The {@link RestClient#run(HttpHost, HttpRequest, 
HttpContext)} method can also be overridden to produce the same results.
+        *      <li>
+        *              Use {@link BeanCreator#impl(Object)} to specify an 
already instantiated instance.
+        *      <li>
+        *              Use {@link BeanCreator#type(Class)} to specify a 
subtype to instantiate.
+        *              <br>Subclass must have a public constructor that takes 
in any args available
+        *              in the bean store of this builder (including {@link 
RestClient} itself).
+        * </ul>
+        *
+        * <ul class='seealso'>
+        *      <li class='jic'>{@link RestCallHandler}
+        * </ul>
+        *
+        * @return The creator for the rest call handler.
+        */
+       public final BeanCreator<RestCallHandler> callHandler() {
+               if (callHandler == null)
+                       callHandler = createCallHandler();
+               return callHandler;
+       }
+
+       /**
+        * Creates the creator for the rest call handler.
+        *
+        * <p>
+        * Subclasses can override this method to provide their own 
implementation.
+        *
+        * <p>
+        * The default behavior creates a bean creator initialized to return a 
{@link BasicRestCallHandler}.
+        *
+        * @return The creator for the rest call handler.
+        * @see #callHandler()
+        */
+       protected BeanCreator<RestCallHandler> createCallHandler() {
+               return 
BeanCreator.create(RestCallHandler.class).type(BasicRestCallHandler.class).store(beanStore);
+       }
+
+       /**
+        * REST call handler class.
+        *
+        * <p>
+        * Specifies a custom handler for making HTTP calls.
+        *
+        * <p>
+        * This is a shortcut for <c>callHandler().type(<jv>value</jv>)</c>.
+        *
+        * @param value
+        *      The new value for this setting.
+        * @return This object (for method chaining).
+        * @see #callHandler()
+        */
+       @FluentSetter
+       public RestClientBuilder callHandler(Class<? extends RestCallHandler> 
value) {
+               callHandler().type(value);
+               return this;
+       }
+
+       
//------------------------------------------------------------------------------------------------------------------
        // errorCodes
        
//------------------------------------------------------------------------------------------------------------------
 
@@ -2157,89 +2248,6 @@ public class RestClientBuilder extends 
BeanContextableBuilder {
        
//-----------------------------------------------------------------------------------------------------------------
 
        /**
-        * <i><l>RestClient</l> configuration property:&emsp;</i>  REST call 
handler.
-        *
-        * <p>
-        * Allows you to provide a custom handler for making HTTP calls.
-        *
-        * <h5 class='section'>Example:</h5>
-        * <p class='bcode w800'>
-        *      <jc>// Create a client that handles processing of requests 
using a custom handler.</jc>
-        *      <jk>public class</jk> MyRestCallHandler <jk>implements</jk> 
RestCallHandler {
-        *
-        *              <ja>@Override</ja>
-        *              <jk>public</jk> HttpResponse run(HttpHost 
<jv>target</jv>, HttpRequest <jv>request</jv>, HttpContext <jv>context</jv>) 
<jk>throws</jk> IOException {
-        *                      <jc>// Custom handle requests.</jc>
-        *              }
-        *      }
-        *
-        *      RestClient <jv>client</jv> = RestClient
-        *              .<jsm>create</jsm>()
-        *              .callHandler(MyRestCallHandler.<jk>class</jk>)
-        *              .build();
-        * </p>
-        *
-        * <ul class='notes'>
-        *      <li>The {@link RestClient#run(HttpHost, HttpRequest, 
HttpContext)} method can also be overridden to produce the same results.
-        * </ul>
-        *
-        * <ul class='seealso'>
-        *      <li class='jic'>{@link RestCallHandler}
-        *      <li class='jf'>{@link RestClient#RESTCLIENT_callHandler}
-        * </ul>
-        *
-        * @param value
-        *      The new value for this setting.
-        *      <br>The default value is <jk>null</jk>.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public RestClientBuilder callHandler(Class<? extends RestCallHandler> 
value) {
-               return set(RESTCLIENT_callHandler, value);
-       }
-
-       /**
-        * <i><l>RestClient</l> configuration property:&emsp;</i>  REST call 
handler.
-        *
-        * <p>
-        * Allows you to provide a custom handler for making HTTP calls.
-        *
-        * <h5 class='section'>Example:</h5>
-        * <p class='bcode w800'>
-        *      <jc>// Create a client that handles processing of requests 
using a custom handler.</jc>
-        *      RestClient <jv>client</jv> = RestClient
-        *              .<jsm>create</jsm>()
-        *              .callHandler(
-        *                      <jk>new</jk> RestCallHandler() {
-        *                              <ja>@Override</ja>
-        *                              <jk>public</jk> HttpResponse 
run(HttpHost <jv>target</jv>, HttpRequest <jv>request</jv>, HttpContext 
<jv>context</jv>) <jk>throws</jk> IOException {
-        *                                      <jc>// Custom handle 
requests.</jc>
-        *                              }
-        *                      }
-        *              )
-        *              .build();
-        * </p>
-        *
-        * <ul class='notes'>
-        *      <li>The {@link RestClient#run(HttpHost, HttpRequest, 
HttpContext)} method can also be overridden to produce the same results.
-        * </ul>
-        *
-        * <ul class='seealso'>
-        *      <li class='jic'>{@link RestCallHandler}
-        *      <li class='jf'>{@link RestClient#RESTCLIENT_callHandler}
-        * </ul>
-        *
-        * @param value
-        *      The new value for this setting.
-        *      <br>The default value is <jk>null</jk>.
-        * @return This object (for method chaining).
-        */
-       @FluentSetter
-       public RestClientBuilder callHandler(RestCallHandler value) {
-               return set(RESTCLIENT_callHandler, value);
-       }
-
-       /**
         * <i><l>RestClient</l> configuration property:&emsp;</i>  Console 
print stream
         *
         * <p>
diff --git 
a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClientBuilder.java
 
b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClientBuilder.java
index da47909..68691b9 100644
--- 
a/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClientBuilder.java
+++ 
b/juneau-rest/juneau-rest-mock/src/main/java/org/apache/juneau/rest/mock/MockRestClientBuilder.java
@@ -725,12 +725,6 @@ public class MockRestClientBuilder extends 
RestClientBuilder {
        }
 
        @Override /* GENERATED - RestClientBuilder */
-       public MockRestClientBuilder callHandler(RestCallHandler value) {
-               super.callHandler(value);
-               return this;
-       }
-
-       @Override /* GENERATED - RestClientBuilder */
        public MockRestClientBuilder clientVersion(String value) {
                super.clientVersion(value);
                return this;
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
index c894810..ab932df 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Config_RestClient_Test.java
@@ -112,7 +112,7 @@ public class RestClient_Config_RestClient_Test {
                        }
                };
                
client().callHandler(A1.class).header("Foo","f1").build().get("/checkHeader").header("Foo","f2").run().assertBody().is("['f1','f2','baz']");
-               
client().callHandler(x).header("Foo","f1").build().get("/checkHeader").header("Foo","f2").run().assertCode().is(201);
+               client().apply(y -> 
y.callHandler().impl(x)).header("Foo","f1").build().get("/checkHeader").header("Foo","f2").run().assertCode().is(201);
        }
 
        @Test

Reply via email to