MyAnnotatedServlet.class.getSimpleName() + ".class"));
IOUtils.copy(annotatedServletClassInputStream, annotatedServletClassOutputStream);
annotatedServletClassInputStream.close();
annotatedServletClassOutputStream.close();
ctx.setResources(new StandardRoot(ctx));
File f1 = new File("test/webapp-virtual-webapp/target/classes");
File f2 = new File("test/webapp-virtual-library/target/WEB-INF/classes");
ctx.getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",
f1.getAbsolutePath(), null, "/");
ctx.getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",
f2.getAbsolutePath(), null, "/");
tomcat.start();
// first test that without the setting on StandardContext the annotated
// servlet is not detected
assertPageContains("/test/annotatedServlet", MyAnnotatedServlet.MESSAGE, 404);
tomcat.stop();
// then test that if we configure StandardContext with the additional
// path, the servlet is detected
ctx.setResources(new StandardRoot(ctx));
ctx.getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",
f1.getAbsolutePath(), null, "/");
ctx.getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",