public class DefaultAgiServer extends AbstractAgiServer implements AgiServer
AgiServer
interface for FastAGI.| Constructor and Description |
|---|
DefaultAgiServer()
Creates a new DefaultAgiServer.
|
DefaultAgiServer(AgiChannelFactory agiChannelFactory)
Creates a new DefaultAgiServer and set a custom factory for creating
AgiChannels
|
DefaultAgiServer(AgiScript agiScript)
Creates a new DefaultAgiServer that runs the given
AgiScript for
all requests. |
DefaultAgiServer(MappingStrategy mappingStrategy)
Creates a new DefaultAgiServer that uses the given
MappingStrategy. |
DefaultAgiServer(String configResourceBundleName)
Creates a new DefaultAgiServer and loads its configuration from an
alternative resource bundle.
|
DefaultAgiServer(String configResourceBundleName,
MappingStrategy mappingStrategy)
Creates a new DefaultAgiServer and loads its configuration from an
alternative resource bundle and uses the given
MappingStrategy. |
DefaultAgiServer(String configResourceBundleName,
MappingStrategy mappingStrategy,
AgiChannelFactory agiChannelFactory)
Creates a new DefaultAgiServer and loads its configuration from an
alternative resource bundle and uses the given
MappingStrategy. |
| Modifier and Type | Method and Description |
|---|---|
protected ServerSocketFacade |
createServerSocket() |
protected void |
finalize() |
InetAddress |
getAddress()
Returns the address this server is configured to bind to.
|
int |
getPort()
Returns the TCP port this server is configured to bind to.
|
static void |
main(String[] args)
Deprecated.
since 1.0.0 use
Cli instead. |
void |
run()
Deprecated.
use
startup() instead. |
void |
setAddress(InetAddress address)
Sets the address to bind server.
|
void |
setBindPort(int bindPort)
Deprecated.
use
setPort(int) instead |
void |
setPort(int port)
Sets the TCP port to listen on for new connections.
|
void |
setSocketReadTimeout(int socketReadTimeout)
Connection is dropped if it stales on read longer than the timeout.
|
void |
shutdown()
Stops this AgiServer.
|
void |
startup()
Starts this AgiServer.
|
createPool, execute, getAgiChannelFactory, getMappingStrategy, getMaximumPoolSize, getPoolActiveTaskCount, getPoolActiveThreadCount, getPoolSize, handleException, isDie, setMappingStrategy, setMaximumPoolSize, setPoolSizepublic DefaultAgiServer()
public DefaultAgiServer(AgiChannelFactory agiChannelFactory)
agiChannelFactory - The factory to use for creating new AgiChannel
instances.public DefaultAgiServer(String configResourceBundleName)
configResourceBundleName - the name of the conifiguration resource
bundle (default is "fastagi").public DefaultAgiServer(MappingStrategy mappingStrategy)
MappingStrategy.mappingStrategy - the MappingStrategy to use to determine the
AgiScript to run.public DefaultAgiServer(AgiScript agiScript)
AgiScript for
all requests.agiScript - the AgiScript to run.public DefaultAgiServer(String configResourceBundleName, MappingStrategy mappingStrategy)
MappingStrategy.configResourceBundleName - the name of the conifiguration resource
bundle (default is "fastagi").mappingStrategy - the MappingStrategy to use to determine the
AgiScript to run.public DefaultAgiServer(String configResourceBundleName, MappingStrategy mappingStrategy, AgiChannelFactory agiChannelFactory)
MappingStrategy.configResourceBundleName - the name of the conifiguration resource
bundle (default is "fastagi").mappingStrategy - the MappingStrategy to use to determine the
AgiScript to run.agiChannelFactory - The factory to use for creating new AgiChannel
instances.@Deprecated public void setBindPort(int bindPort)
setPort(int) insteadbindPort - the port to bind to.public void setPort(int port)
port - the port to bind to.public int getPort()
public InetAddress getAddress()
public void setAddress(InetAddress address)
address - the address to bind to.public void setSocketReadTimeout(int socketReadTimeout)
AgiServersetSocketReadTimeout in interface AgiServersocketReadTimeout - the read timeout value to be used in
milliseconds.Socket.setSoTimeout(int)protected ServerSocketFacade createServerSocket() throws IOException
IOExceptionpublic void startup()
throws IOException,
IllegalStateException
AgiServerAfter calling startup() this AgiServer is ready to receive requests from Asterisk servers and process them.
Note that this method will not return until the AgiServer has been shut down.
If you want to run the AgiServer in the background use wrap it with an
AgiServerThread.
startup in interface AgiServerIOException - if the server socket cannot be bound.IllegalStateException - if this AgiServer is already running.@Deprecated public void run()
startup() instead.public void shutdown()
throws IllegalStateException
AgiServer
The server socket is closed, new connections are refused and resources
are freed. Any running AgiScripts are finish before shutdown
completes.
shutdown in interface AgiServershutdown in class AbstractAgiServerIllegalStateException - if this AgiServer is already shut down or
has not yet been started.protected void finalize()
throws Throwable
finalize in class AbstractAgiServerThrowable@Deprecated public static void main(String[] args) throws Exception
Cli instead.args - not usedException - if the server can't be startedCopyright © 2004–2020. All rights reserved.