public class ProxyProcessingChain
extends org.apache.commons.chain.impl.ChainBase
Convenience base class for reverse proxy processing Chain implementation.
| Constructor and Description |
|---|
ProxyProcessingChain()
Constructs a
ProxyProcessingChain with no configured Commands. |
ProxyProcessingChain(Collection commands)
Constructs a
ProxyProcessingChain configured with the specified
Commands. |
ProxyProcessingChain(org.apache.commons.chain.Command command)
Constructs a
ProxyProcessingChain configured with the specified
Command. |
ProxyProcessingChain(org.apache.commons.chain.Command[] commands)
Constructs a
ProxyProcessingChain configured with the specified
Commands. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommand(int index,
org.apache.commons.chain.Command command)
Add a
Command at the given index of the list of
Commands that will be called in turn when this Chain's
execute() method is called. |
boolean |
execute(org.apache.commons.chain.Context context) |
List<AbstractProxyCommand> |
getAllProxyCommands()
Return a list including all the descendant
Commands,
type of which is AbstractProxyCommand
in this proxy processing chain. |
org.apache.commons.chain.Command |
getCommand(int index)
Finds and returns the
Command at the given index of the Command list. |
int |
getCommandCount()
Return the size of the internal
Command list. |
int |
getCommandIndex(Class<? extends org.apache.commons.chain.Command> commandType)
Return the index of the given class type of
Command in the command list. |
int |
getCommandIndex(org.apache.commons.chain.Command command)
Return the index of the given
Command in the command list. |
boolean |
removeCommand(org.apache.commons.chain.Command command)
Remove the
Command from the list of
Commands that will be called in turn when this Chain's
execute() method is called. |
boolean |
removeCommand(int index)
Remove the
Command at the given index of the list of
Commands that will be called in turn when this Chain's
execute() method is called. |
public ProxyProcessingChain()
ProxyProcessingChain with no configured Commands.public ProxyProcessingChain(org.apache.commons.chain.Command command)
ProxyProcessingChain configured with the specified
Command.command - public ProxyProcessingChain(org.apache.commons.chain.Command[] commands)
ProxyProcessingChain configured with the specified
Commands.commands - public ProxyProcessingChain(Collection commands)
ProxyProcessingChain configured with the specified
Commands.commands - public int getCommandCount()
Command list.public int getCommandIndex(org.apache.commons.chain.Command command)
Command in the command list.
If not found, it should return -1.command - public int getCommandIndex(Class<? extends org.apache.commons.chain.Command> commandType)
Command in the command list.
If not found, it should return -1.commandType - public org.apache.commons.chain.Command getCommand(int index)
Command at the given index of the Command list.index - public void addCommand(int index,
org.apache.commons.chain.Command command)
Add a Command at the given index of the list of
Commands that will be called in turn when this Chain's
execute() method is called.
Once execute() has been called
at least once, it is no longer possible to add additional
Commands; instead, an exception will be thrown.
index - The index at which the command should be insertedcommand - The Command to be addedIllegalArgumentException - if command
is null, or
index is negative or greater than the size of the command list.IllegalStateException - if this Chain has already
been executed at least once, so no further configuration is allowedpublic boolean removeCommand(int index)
Remove the Command at the given index of the list of
Commands that will be called in turn when this Chain's
execute() method is called.
Once execute() has been called
at least once, it is no longer possible to add additional
Commands; instead, an exception will be thrown.
index - The index to add in the command listIllegalArgumentException - if index is out of bound.IllegalStateException - if this Chain has already
been executed at least once, so no further configuration is allowedpublic boolean removeCommand(org.apache.commons.chain.Command command)
Remove the Command from the list of
Commands that will be called in turn when this Chain's
execute() method is called.
Once execute() has been called
at least once, it is no longer possible to add additional
Commands; instead, an exception will be thrown.
command - The Command to be addedIllegalArgumentException - if index is out of bound.IllegalStateException - if this Chain has already
been executed at least once, so no further configuration is allowedpublic boolean execute(org.apache.commons.chain.Context context)
throws ReverseProxyException,
IOException
Note: The method implementation takes the strategy to catch all the exceptions thrown while executing commands in the chain in order to proceed to the next commands even when a command throws an exception in an earlier step. This guarantees each of the internal commands are always to execute. So, for example, a command, which is responsible for cleaning up all the resources used during the reverse proxy processing, will always have a chance to do its job in this reverse proxy processing chain.
execute in interface org.apache.commons.chain.Chainexecute in interface org.apache.commons.chain.Commandexecute in class org.apache.commons.chain.impl.ChainBaseReverseProxyExceptionIOExceptionpublic List<AbstractProxyCommand> getAllProxyCommands()
Commands,
type of which is AbstractProxyCommand
in this proxy processing chain.Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.