if (resourcePath == null) {
// Register and map the dispatcher servlet
final ServletHolder servletHolder = new ServletHolder(new CXFCdiServlet());
final ServletContextHandler context = new ServletContextHandler();
context.setContextPath(contextPath);
context.addEventListener(new Listener());
context.addEventListener(new BeanManagerResourceBindingListener());
context.addServlet(servletHolder, "/rest/*");
server.setHandler(context);
} else {
final WebAppContext context = new WebAppContext();