从嵌入式Tomcat 7的已编译jar文件加载webapp

Pet*_*lev 5 jsp web-applications executable-jar embedded-tomcat-7

我通常使用嵌入式jetty服务器开发Web应用程序,并使用Launcher4j等应用程序将它们包装在.exe文件中.我喜欢将我的Web应用程序文件夹放在java包中并从那里读取它,而不是将它放在生成的.exe文件旁边的文件夹中.我喜欢这样做以保护我的webapp不被编辑.使用嵌入式jetty服务器,它是这样完成的:

String jetty_home = MyClass.class.getClassLoader().getResource(webappsClassPath).toExternalForm();
    WebAppContext webapp = new WebAppContext();
    webapp.setServer(server);
    webapp.setContextPath(contextPath);
    webapp.setResourceBase(jetty_home + "/webapps/MyWebapp");
    webapp.setWar(webappsFolder);
    webapp.setParentLoaderPriority(true);
Run Code Online (Sandbox Code Playgroud)

如何使用嵌入式Tomcat 7或Tomcat 8-alpha服务器进行相同的管理?谢谢!:)