This class is built on top of the StringMap class and
adds methods for reading Asterisk ManagerInterface replies.
Mime-style headers, followed by a blank line, or
The header "Response: follows", followed by zero or more
additional headers, followed by one or more
lines of output, followed by the line:
--END COMMAND--
Unfortunately, the first line of the following response can have a
":" in it, making it indistinguishable from another header [they
should'a added a blank line after the last header]. We need to use
some heuristics to figure out if it's a header or data. grumph!
XXX to do:
Any time data follows, the "ActionID" key (if present) will always
be the last key before the data starts. We could use that, or if
the data consists of what looks like headers, then just make them
headers, and don't stuff them into "data", which is sort-of what
happens now.
In the second case, all the response data is put in a header called:
data:
This is modelled after MimeHeaders.
Methods inherited from class sunlabs.brazil.util.StringMap |
add, append, clear, elements, get, get, get, get, getKey, isEmpty, keys, put, put, put, remove, remove, remove, size, toString, toString |
AsteriskHandler.AmiStringMap
public AsteriskHandler.AmiStringMap()
AsteriskHandler.AmiStringMap
public AsteriskHandler.AmiStringMap(StringMap map)
read
public void read(HttpInputStream in)
throws IOException
- Throws:
IOException
commandify
public String commandify(String id)
- Turn an AmiMap into an asterisk command.
Make sure the "Action" keyword exists and is first.
- Parameters:
id
- add the "id" at the end of the actionid
- Returns:
- null if there wasn't a valid command
commandify
public static String commandify(StringMap map,
String id)