@Override
 public void removeServlet(final ServletModel model) {
   LOG.debug("remove servlet [{}]", model);
   final Context context = findContext(model);
   if (context == null) {
     throw new TomcatRemoveServletException(
         "cannot remove servlet cannot find the associated container: " + model);
   }
   final Container servlet = context.findChild(model.getName());
   if (servlet == null) {
     throw new TomcatRemoveServletException("cannot find the servlet to remove: " + model);
   }
   context.removeChild(servlet);
 }
  @Override
  public void addServlet(final ServletModel model) {
    LOG.debug("add servlet [{}]", model);
    final Context context = findOrCreateContext(model.getContextModel());
    final String servletName = model.getName();
    // Wrapper wrapper = Tomcat.addServlet( context, servletName,
    // model.getServlet() );

    Wrapper sw = null;

    if (model.getServlet() == null) {
      // will do class for name and set init params
      sw = context.createWrapper();
    } else {
      sw =
          new ExistingStandardWrapper(model.getServlet()) {

            @Override
            protected void initInternal() throws LifecycleException {
              super.initInternal();
              try {
                super.loadServlet();
              } catch (final ServletException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            }
          };
    }

    sw.setName(servletName);
    context.addChild(sw);

    addServletMappings(context, servletName, model.getUrlPatterns());
    addInitParameters(sw, model.getInitParams());
  }