public class CachingPolicy extends AbstractMappedPolicy<CachingConfig> implements io.apiman.gateway.engine.policy.IDataPolicy
| Modifier and Type | Field and Description |
|---|---|
static String |
CACHED_RESPONSE |
| Constructor and Description |
|---|
CachingPolicy()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doApply(io.apiman.gateway.engine.beans.ServiceRequest request,
io.apiman.gateway.engine.policy.IPolicyContext context,
CachingConfig config,
io.apiman.gateway.engine.policy.IPolicyChain<io.apiman.gateway.engine.beans.ServiceRequest> chain)
If the request is cached an
IConnectorInterceptor is set in order to prevent the back-end connection to be established. |
protected void |
doApply(io.apiman.gateway.engine.beans.ServiceResponse response,
io.apiman.gateway.engine.policy.IPolicyContext context,
CachingConfig config,
io.apiman.gateway.engine.policy.IPolicyChain<io.apiman.gateway.engine.beans.ServiceResponse> chain)
Apply the policy to the response.
|
protected Class<CachingConfig> |
getConfigurationClass() |
io.apiman.gateway.engine.io.IReadWriteStream<io.apiman.gateway.engine.beans.ServiceRequest> |
getRequestDataHandler(io.apiman.gateway.engine.beans.ServiceRequest request,
io.apiman.gateway.engine.policy.IPolicyContext context)
The request will not be altered.
|
io.apiman.gateway.engine.io.IReadWriteStream<io.apiman.gateway.engine.beans.ServiceResponse> |
getResponseDataHandler(io.apiman.gateway.engine.beans.ServiceResponse response,
io.apiman.gateway.engine.policy.IPolicyContext context)
The response is received from the back-end service and needs to be written into the
CachedResponse. |
apply, apply, parseConfigurationpublic static final String CACHED_RESPONSE
protected Class<CachingConfig> getConfigurationClass()
getConfigurationClass in class AbstractMappedPolicy<CachingConfig>io.apiman.gateway.engine.policy.AbstractPolicy#getConfigurationClass()protected void doApply(io.apiman.gateway.engine.beans.ServiceRequest request,
io.apiman.gateway.engine.policy.IPolicyContext context,
CachingConfig config,
io.apiman.gateway.engine.policy.IPolicyChain<io.apiman.gateway.engine.beans.ServiceRequest> chain)
IConnectorInterceptor is set in order to prevent the back-end connection to be established.
Otherwise an empty CachedResponse will be added to the context, this will be used to cache the response once it has been
received from the back-end serviceprotected void doApply(io.apiman.gateway.engine.beans.ServiceResponse response,
io.apiman.gateway.engine.policy.IPolicyContext context,
CachingConfig config,
io.apiman.gateway.engine.policy.IPolicyChain<io.apiman.gateway.engine.beans.ServiceResponse> chain)
AbstractMappedPolicydoApply in class AbstractMappedPolicy<CachingConfig>AbstractMappedPolicy.doApply(ServiceResponse, IPolicyContext, Object, IPolicyChain)public io.apiman.gateway.engine.io.IReadWriteStream<io.apiman.gateway.engine.beans.ServiceRequest> getRequestDataHandler(io.apiman.gateway.engine.beans.ServiceRequest request,
io.apiman.gateway.engine.policy.IPolicyContext context)
getRequestDataHandler in interface io.apiman.gateway.engine.policy.IDataPolicyIDataPolicy.getRequestDataHandler(ServiceRequest, IPolicyContext)public io.apiman.gateway.engine.io.IReadWriteStream<io.apiman.gateway.engine.beans.ServiceResponse> getResponseDataHandler(io.apiman.gateway.engine.beans.ServiceResponse response,
io.apiman.gateway.engine.policy.IPolicyContext context)
CachedResponse.
The headers, response code and message should be written at this point and once the CachedResponse
is set, can be stored into the IDataStoreComponentgetResponseDataHandler in interface io.apiman.gateway.engine.policy.IDataPolicyIDataPolicy.getResponseDataHandler(ServiceResponse, IPolicyContext)Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.