/**
* Add new servlet according {@link Application} subclass with {@link ApplicationPath} annotation.
*/
private static void addServletWithApplication(final ServletContext sc, final Class<? extends Application> a,
final Set<Class<?>> classes) throws ServletException {
final ApplicationPath ap = a.getAnnotation(ApplicationPath.class);
if (ap != null) {
// App is annotated with ApplicationPath
final ResourceConfig resourceConfig = ResourceConfig.forApplicationClass(a, classes);
final ServletContainer s = new ServletContainer(resourceConfig);
final ServletRegistration.Dynamic dsr = sc.addServlet(a.getName(), s);