|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.asteriskjava.fastagi.AbstractAgiServer
org.asteriskjava.fastagi.DefaultAgiServer
public class DefaultAgiServer
Default implementation of the AgiServer
interface for FastAGI.
Constructor Summary | |
---|---|
DefaultAgiServer()
Creates a new DefaultAgiServer. |
|
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(java.lang.String configResourceBundleName)
Creates a new DefaultAgiServer and loads its configuration from an alternative resource bundle. |
|
DefaultAgiServer(java.lang.String configResourceBundleName,
MappingStrategy mappingStrategy)
Creates a new DefaultAgiServer and loads its configuration from an alternative resource bundle and uses the given MappingStrategy . |
Method Summary | |
---|---|
protected ServerSocketFacade |
createServerSocket()
|
protected void |
finalize()
|
int |
getPort()
Returns the TCP port this server is configured to bind to. |
static void |
main(java.lang.String[] args)
|
void |
run()
|
void |
setBindPort(int bindPort)
Deprecated. use setPort(int) instead |
void |
setPort(int port)
Sets the TCP port to listen on for new connections. |
void |
shutdown()
Stops this AgiServer. |
void |
startup()
Starts this AgiServer. |
Methods inherited from class org.asteriskjava.fastagi.AbstractAgiServer |
---|
createPool, execute, getMappingStrategy, handleException, isDie, setMappingStrategy, setMaximumPoolSize, setPoolSize |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultAgiServer()
public DefaultAgiServer(java.lang.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(java.lang.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.Method Detail |
---|
public void setBindPort(int bindPort)
setPort(int)
instead
bindPort
- the port to bind to.public void setPort(int port)
port
- the port to bind to.public int getPort()
protected ServerSocketFacade createServerSocket() throws java.io.IOException
java.io.IOException
public void startup() throws java.io.IOException, java.lang.IllegalStateException
AgiServer
After 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 AgiServer
java.io.IOException
- if the server socket cannot be bound.
java.lang.IllegalStateException
- if this AgiServer is already running.public void run()
public void shutdown() throws java.lang.IllegalStateException
AgiServer
The server socket is closed, new connections are refused and resources
are freed. Any running AgiScript
s are finish before shutdown
completes.
shutdown
in interface AgiServer
shutdown
in class AbstractAgiServer
java.lang.IllegalStateException
- if this AgiServer is already shut down or
has not yet been started.protected void finalize() throws java.lang.Throwable
finalize
in class AbstractAgiServer
java.lang.Throwable
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |