Package org.chenile.proxy.builder
Class ProxyBuilder
java.lang.Object
org.chenile.proxy.builder.ProxyBuilder
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
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate class
static enum
-
Field Summary
Modifier and TypeFieldDescriptionprivate ChenileExchangeBuilder
(package private) OrchExecutor<ChenileExchange>
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
buildProxy
(Class<T> interfaceToProxy, String serviceName, HeaderCopier headerCopier, String baseUrl) Build proxy for an interface.<T> T
buildProxy
(Class<T> interfaceToProxy, String serviceName, HeaderCopier headerCopier, ProxyBuilder.ProxyMode proxyMode, String baseUrl) This is used for testing purposes.
-
Field Details
-
PROXYMODE
- See Also:
-
REMOTE_URL_BASE
- See Also:
-
chenileProxyOrchExecutor
@Autowired @Qualifier("chenileProxyOrchExecutor") OrchExecutor<ChenileExchange> chenileProxyOrchExecutor -
chenileExchangeBuilder
-
-
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 proxiedserviceName
- - name of the serviceheaderCopier
- this copies headers from the source to the target CHenile exchangeproxyMode
- - can be set to always proxy local or remote for testing purposes- Returns:
- the proxy that can be used in lieu of the service
-