Class ProxyBuilder

java.lang.Object
org.chenile.proxy.builder.ProxyBuilder

public class ProxyBuilder extends Object
Creates a proxy for a chenile interface. A proxy allows the clients to avail the benefits of interception, transformation, caching etc. The chain of execution includes a router that determine if a local or remote http proxy must be used to invoke the actual service
Author:
Raja Shankar Kolluru
  • Field Details

  • Constructor Details

    • ProxyBuilder

      public ProxyBuilder()
  • Method Details

    • buildProxy

      public <T> T buildProxy(Class<T> interfaceToProxy, String serviceName, HeaderCopier headerCopier, String baseUrl)
      Build proxy for an interface. The headers from the current request are copied using the headerCopier. The service name is the service which is being proxied
      Type Parameters:
      T -
      Parameters:
      interfaceToProxy -
      serviceName -
      headerCopier -
      Returns:
    • buildProxy

      public <T> T buildProxy(Class<T> interfaceToProxy, String serviceName, HeaderCopier headerCopier, ProxyBuilder.ProxyMode proxyMode, String baseUrl)
      This is used for testing purposes. For production, please make sure that proxy mode is set to COMPUTE_DYNAMICALLY
      Type Parameters:
      T - Interface to proxy class
      Parameters:
      interfaceToProxy - the interface that needs to be proxied
      serviceName - - name of the service
      headerCopier - this copies headers from the source to the target CHenile exchange
      proxyMode - - can be set to always proxy local or remote for testing purposes
      Returns:
      the proxy that can be used in lieu of the service