title: spring + Embedded jetty + <web-app> how to create context
body: <p>There is a maven-project, with /WEB-INF/web.xml :</p>
  
  <pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5"&gt;
  
  &lt;servlet&gt;
  &lt;servlet-name&gt;baseWebApp&lt;/servlet-name&gt;
  &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
  &lt;init-param&gt;
      &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
      &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
  &lt;servlet-name&gt;baseWebApp&lt;/servlet-name&gt;
  &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>and with applicationContext.xml :</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"           xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
                      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
                      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"&gt;
  
         &lt;import resource="classpath:dataSource.xml"/&gt;
  
         &lt;mvc:annotation-driven/&gt;
         &lt;context:component-scan base-package="com.blogspot.permgen.webapp"/&gt;
  
         &lt;mvc:resources mapping="/resources/**" location="/resources/"/&gt;
  
         &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
               p:prefix="/WEB-INF/pages/"
           p:suffix=".jsp"/&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>The controller is based oh annotations. </p>
  
  <p>When launched by <strong>mvn -Djetty.port=9999 jetty:run</strong> applicaton starts well. I decided to initialize jetty in code, but failed to create context for it. Here is main class:</p>
  
  <pre><code>public class AppMain {
  public static void main(String[] args) throws Exception {
  
      ServletContextHandler sch = new ServletContextHandler();
  
  /*here must be context initialization ... */
  
      Server jetty = new Server(9999);
      jetty.setHandler(sch);
      jetty.start();
  }
  }
  </code></pre>
  
  <p>So question is: how to init context for jetty from web.xml ?<br>
  Is it possible at all, or i have to parse it somehow with using of spring?</p>