}
return count;
}
private WebDeploymentController startWebApp(WebHost host) throws Exception {
WebDeploymentBuilder builder = new WebDeploymentBuilder();
WebDeploymentController deployment;
try {
builder.setContextRoot(contextRoot);
File docBase = new File(serverTempDir, contextRoot);
if (!docBase.exists()) {
docBase.mkdirs();
}
builder.setDocumentRoot(docBase);
builder.setClassLoader(classloader);
final int j = servletClass.indexOf(".");
final String servletName = j < 0 ? servletClass : servletClass.substring(j + 1);
final Class<?> clazz = classloader.loadClass(servletClass);
ServletBuilder servlet = new ServletBuilder();
servlet.setServletName(servletName);
servlet.setServlet((Servlet) clazz.newInstance());
servlet.setServletClass(clazz);
servlet.addUrlMapping(urlPattern);
builder.addServlet(servlet);
deployment = host.addWebDeployment(builder);
deployment.create();
} catch (Exception e) {