title: Is there a way to set context-params programmatically in embedded jetty?
body: <p>Looking at the following example of an embedded Jetty Example:
  <a href="http://musingsofaprogrammingaddict.blogspot.com.au/2009/12/running-jsf-2-on-embedded-jetty.html" rel="noreferrer">http://musingsofaprogrammingaddict.blogspot.com.au/2009/12/running-jsf-2-on-embedded-jetty.html</a></p>
  
  <p>The following code sample is given (below. </p>
  
  <p>The author then goes on an gives an example of referring to context params in a web.xml file. eg </p>
  
  <pre><code>...
  &lt;context-param&gt;
    &lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
    &lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt;
  &lt;/context-param&gt;
  ...
  </code></pre>
  
  <p>My question is - if I want to do everything in a Java class - is there a way to set context-params programmatically?</p>
  
  <pre><code>public class JettyRunner {
  
      public static void main(String[] args) throws Exception {
  
          Server server = new Server();
  
          Connector connector = new SelectChannelConnector();
          connector.setPort(8080);
          connector.setHost("127.0.0.1");
          server.addConnector(connector);
  
          WebAppContext wac = new AliasEnhancedWebAppContext();
          wac.setContextPath("/myapp");
          wac.setBaseResource(
              new ResourceCollection(
                  new String[] {"./src/main/webapp", "./target"}));
          wac.setResourceAlias("/WEB-INF/classes/", "/classes/");
  
          server.setHandler(wac);
          server.setStopAtShutdown(true);
          server.start();
          server.join();
      }
  }
  </code></pre>