private static void addServlets(JBossWebMetaData jbwebMD, StandardContext context) {
    for (JBossServletMetaData smd : jbwebMD.getServlets()) {
      final String sc = smd.getServletClass();
      if (sc.equals(WSFServlet.class.getName())) {
        final String servletName = smd.getServletName();
        List<ParamValueMetaData> params = smd.getInitParam();
        List<String> urlPatterns = null;
        for (ServletMappingMetaData smmd : jbwebMD.getServletMappings()) {
          if (smmd.getServletName().equals(servletName)) {
            urlPatterns = smmd.getUrlPatterns();
            break;
          }
        }

        WSFServlet wsfs = new WSFServlet();
        Wrapper wsfsWrapper = context.createWrapper();
        wsfsWrapper.setName(servletName);
        wsfsWrapper.setServlet(wsfs);
        wsfsWrapper.setServletClass(WSFServlet.class.getName());
        for (ParamValueMetaData param : params) {
          wsfsWrapper.addInitParameter(param.getParamName(), param.getParamValue());
        }
        context.addChild(wsfsWrapper);
        for (String urlPattern : urlPatterns) {
          context.addServletMapping(urlPattern, servletName);
        }
      }
    }
  }
  @Override
  public synchronized void start() throws Exception {

    Host host = ServerUtil.getDefaultHost().getHost();
    _serverContext = (StandardContext) host.findChild("/" + _contextName);
    if (_serverContext == null) {
      _serverContext = new StandardContext();
      _serverContext.setPath("/" + _contextName);
      File docBase = new File(SERVER_TEMP_DIR, _contextName);
      if (!docBase.exists()) {
        if (!docBase.mkdirs()) {
          throw new RuntimeException("Unable to create temp directory " + docBase.getPath());
        }
      }
      _serverContext.setDocBase(docBase.getPath());
      _serverContext.addLifecycleListener(new ContextConfig());

      final Loader loader = new WebCtxLoader(Thread.currentThread().getContextClassLoader());
      loader.setContainer(host);
      _serverContext.setLoader(loader);
      _serverContext.setInstanceManager(new LocalInstanceManager());

      Wrapper wrapper = _serverContext.createWrapper();
      wrapper.setName(SERVLET_NAME);
      wrapper.setServletClass(SwitchYardRemotingServlet.class.getName());
      wrapper.setLoadOnStartup(1);
      _serverContext.addChild(wrapper);
      _serverContext.addServletMapping("/*", SERVLET_NAME);

      host.addChild(_serverContext);
      _serverContext.create();
      _serverContext.start();

      SwitchYardRemotingServlet remotingServlet = (SwitchYardRemotingServlet) wrapper.getServlet();
      remotingServlet.setEndpointPublisher(this);
      _log.info("Published Remote Service Endpoint " + _serverContext.getPath());
    } else {
      throw new RuntimeException("Context " + _contextName + " already exists!");
    }
  }