Looking at the following example of an embedded Jetty Example: http://musingsofaprogrammingaddict.blogspot.com.au/2009/12/running-jsf-2-on-embedded-jetty.html
The following code sample is given (below.
The author then goes on an gives an example of referring to context params in a web.xml file. eg
...
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
...
My question is - if I want to do everything in a Java class - is there a way to set context-params programmatically?
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();
}
}
In your case
wac.setInitParameter("com.sun.faces.expressionFactory",
"com.sun.el.ExpressionFactoryImpl")
will do.