嵌入应用的jetty 访问应用资源问题

<p>若是在一个应用中嵌入一个jetty </p> <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:44d9d94c-7d33-46c3-949e-ef8097cbb8f3" class="wlWriterEditableSmartContent"><pre class="brush: java; gutter: true; first-line: 1; tab-size: 4; toolbar: true; width: 885px; height: 303px;" style=" width: 885px; height: 303px;overflow: auto;">public class OneServletContext { public static void main(String[] args) throws Exception { Server server = new Server(8080);java

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath(&quot;/&quot;);
    server.setHandler(context);

    context.addServlet(new ServletHolder(new HelloServlet()),&quot;/*&quot;);
    context.addServlet(new ServletHolder(new HelloServlet(&quot;Buongiorno Mondo&quot;)),&quot;/it/*&quot;);
    context.addServlet(new ServletHolder(new HelloServlet(&quot;Bonjour le Monde&quot;)),&quot;/fr/*&quot;);

    server.start();
    server.join();
}

}</pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com --></div>web

<p>HelloServlet 类是能够访问应用中的资源的 </p>app

<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:3bcff60e-bb88-42f2-8be0-05caf5fa9ac8" class="wlWriterEditableSmartContent"><pre class="brush: java; gutter: true; first-line: 1; tab-size: 4; toolbar: true; width: 885px; height: 331px;" style=" width: 885px; height: 331px;overflow: auto;">public class ManyContexts { public static void main(String[] args) throws Exception { Server server = new Server(8080);webapp

WebAppContext webapp = new WebAppContext();
    webapp.setContextPath(&quot;/ctx1&quot;);
    webapp.setWar(jetty_home+&quot;/webapps/test.war&quot;);

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    contexts.setHandlers(new Handler[] { webapp });

    server.setHandler(contexts);

    server.start();
    server.join();
}

}</pre><!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin. http://dunnhq.com --></div>code

<p>test.war 中的类是不能访问到应用中的资源的</p>orm