H - Head typepublic abstract class Chain<H> extends AbstractStream<H> implements IAbortable, IPolicyChain<H>, Iterable<PolicyWithConfiguration>
write(IApimanBuffer), followed by the end() signal.
Intermediate policy handlers are chained together, according to the
ordering provided by #policyIterator().
The tail handler is executed last: the result object (getHead() is
sent to handleHead(Object); chunks are streamed to out
AbstractStream.handleBody(IApimanBuffer); end of transmission indicated via
AbstractStream.handleEnd().bodyHandler, endHandler, finished, headHandler| Constructor and Description |
|---|
Chain(List<PolicyWithConfiguration> policies,
IPolicyContext context)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Send abort signal to all policies.
|
protected abstract void |
applyPolicy(PolicyWithConfiguration policy,
IPolicyContext context)
Called to apply the given policy to the service object (request or response).
|
protected void |
chainPolicyHandlers()
Chain together the body handlers.
|
void |
doApply(H serviceObject)
Called by a policy when it has successfully completed applying itself.
|
void |
doFailure(io.apiman.gateway.engine.beans.PolicyFailure failure)
Handle a policy failure.
|
void |
end()
Signal transmission has ended.
|
protected IPolicyContext |
getContext() |
H |
getHead()
Return the head object's handler (e.g.
|
List<PolicyWithConfiguration> |
getPolicies() |
protected abstract IReadWriteStream<H> |
getServiceHandler(IPolicy policy)
Gets the service handler for the policy.
|
protected void |
handleHead(H service)
Called to handle the head.
|
void |
policyErrorHandler(IAsyncHandler<Throwable> policyErrorHandler)
Sets the policy error handler.
|
void |
policyFailureHandler(IAsyncHandler<io.apiman.gateway.engine.beans.PolicyFailure> failureHandler)
Sets the policy failure handler.
|
void |
throwError(Throwable error)
Called when an unexpected and unrecoverable error is encountered.
|
void |
write(IApimanBuffer chunk)
Write a chunk to the stream.
|
bodyHandler, endHandler, handleBody, handleEnd, headHandler, isFinishedpublic Chain(List<PolicyWithConfiguration> policies, IPolicyContext context)
policies - context - protected void chainPolicyHandlers()
public void doApply(H serviceObject)
IPolicyChaindoApply in interface IPolicyChain<H>IPolicyChain.doApply(java.lang.Object)public void write(IApimanBuffer chunk)
IWriteStreamIWriteStream.end() has been signalled.write in interface IWriteStreamwrite in class AbstractStream<H>AbstractStream.write(io.apiman.gateway.engine.io.IApimanBuffer)public void end()
IWriteStreamIWriteStream.write(IApimanBuffer) should be made.end in interface IWriteStreamend in class AbstractStream<H>AbstractStream.end()public H getHead()
IReadStreamServiceRequest).getHead in interface IReadStream<H>IReadStream.getHead()protected void handleHead(H service)
AbstractStreamhandleHead in class AbstractStream<H>AbstractStream.handleHead(java.lang.Object)public void policyFailureHandler(IAsyncHandler<io.apiman.gateway.engine.beans.PolicyFailure> failureHandler)
failureHandler - public void doFailure(io.apiman.gateway.engine.beans.PolicyFailure failure)
doFailure in interface IPolicyChain<H>failure - the policy failurepublic void policyErrorHandler(IAsyncHandler<Throwable> policyErrorHandler)
policyErrorHandler - public void throwError(Throwable error)
throwError in interface IPolicyChain<H>error - public void abort()
abort in interface IAbortableprotected abstract IReadWriteStream<H> getServiceHandler(IPolicy policy)
policy - protected abstract void applyPolicy(PolicyWithConfiguration policy, IPolicyContext context)
policy - context - public List<PolicyWithConfiguration> getPolicies()
protected IPolicyContext getContext()
Copyright © 2014 JBoss, a division of Red Hat. All rights reserved.