SipServlet annotation = (SipServlet) clazz.getAnnotation(SipServlet.class);
SipServletHolder holder = new SipServletHolder();
SipAppContext context = (SipAppContext) _context;
if (!Util.isEmpty(annotation.applicationName()))
{
if (context.getName() != null && !context.getName().equals(annotation.applicationName()))
throw new IllegalStateException("App-name in sip.xml: " + context.getName()
+ " does not match with SipApplication annotation: " + annotation.applicationName());
context.getSipMetaData().setAppName(annotation.applicationName());
}
if (annotation.name() != null && !"".equals(annotation.name()))
holder.setName(annotation.name());
else
holder.setName(_className.substring(_className.lastIndexOf('.') + 1));
holder.setInitOrder(annotation.loadOnStartup());
holder.setDisplayName(annotation.description());
holder.setClassName(_className);
context.addSipServlet(holder);
}