public class AsteriskAGIHandler extends Template implements Handler, java.lang.Runnable
(Implementation notes)
This class implements 4 different threads:
- handler/init: to get the config params and start the listening socket
- The thread that listens and accepts connections from *
- the threads that handle the incoming agi requests
- the threads that do the template
| Constructor and Description |
|---|
AsteriskAGIHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
done(RewriteContext hr)
Close the socket connection.
|
boolean |
init(RewriteContext hr)
Open the socket's streams at top of page.
|
boolean |
init(Server server,
java.lang.String prefix)
Start a Listening socket thread, and wait for AGI connections.
|
boolean |
respond(Request request)
We don't handle any "normal" requests.
|
void |
run()
Either start a listening socket or handle an AGI request.
|
void |
tag_agi(RewriteContext hr)
Provide the 'agi' tag.
|
public boolean init(Server server, java.lang.String prefix)
init in interface Handlerserver - The HTTP server that created this Handler.
Typical Handlers will use Server.props
to obtain run-time configuration information.prefix - The handlers name.
The string this Handler may prepend to all
of the keys that it uses to extract configuration information
from Server.props. This is set (by the Server
and ChainHandler) to help avoid configuration parameter
namespace collisions.true if this Handler initialized
successfully, false otherwise. If
false is returned, this Handler
should not be used.public boolean respond(Request request) throws java.io.IOException
respond in interface Handlerrequest - The Request object that represents the HTTP
request.java.io.IOException - if there was an I/O error while sending the response to
the client. Typically, in that case, the Server
will (try to) send an error message to the client and then
close the client's connection.
The IOException should not be used to silently
ignore problems such as being unable to access some
server-side resource (for example getting a
FileNotFoundException due to not being able
to open a file). In that case, the Handler's
duty is to turn that IOException into a
HTTP response indicating, in this case, that a file could
not be found.
public boolean init(RewriteContext hr)
init in interface TemplateInterfaceinit in class Templatepublic boolean done(RewriteContext hr)
done in interface TemplateInterfacedone in class Templatepublic void tag_agi(RewriteContext hr)
public void run()
run in interface java.lang.Runnable