public void visitServlet(WebAppContext context, Descriptor descriptor, XmlParser.Node node)
{
String servletName = node.getString("servlet-name", false, true);
String servletClass = node.getString("servlet-class", false, true);
// FIXME allow deploy with prefix: javaee:servlet-name
SipServletHolder holder = new SipServletHolder();
holder.setName(servletName);
holder.setClassName(servletClass);
Iterator params = node.iterator("init-param");
while (params.hasNext())
{
XmlParser.Node param = (XmlParser.Node) params.next();
String pName = param.getString("param-name", false, true);
String pValue = param.getString("param-value", false, true);
holder.setInitParameter(pName, pValue);
}
XmlParser.Node startup = node.get("load-on-startup");
if (startup != null)
{
String s = startup.toString(false, true);
int order = 0;
if (s != null && s.trim().length() > 0)
{
try
{
order = Integer.parseInt(s);
}
catch (NumberFormatException e)
{
Log.warn("Cannot parse load-on-startup " + s);
}
}
holder.setInitOrder(order);
}
// FIXME use same instance for listener and servlet
((SipAppContext) context).addSipServlet(holder);
}