I am running an embedded server using jetty and providing resource base and descriptors to start the server. I have some context-parameters in my web.xml file which I need to read. I have tried searching but couldn't find a way to do that. Here is my code.
static int port = 8081;
static Server server;
public static void start(String[] args) {
while (!stop) {
server = new Server(port);
String wardir = "webapps/war";
WebAppContext context = new WebAppContext();
context.setResourceBase(wardir);
String webXML = "/WEB-INF/web.xml";
context.setDescriptor("wardir + webXML");
context.setConfigurations(new Configuration[]{
new AnnotationConfiguration(), new WebXmlConfiguration(),
new WebInfConfiguration(), new TagLibConfiguration(),
new PlusConfiguration(), new MetaInfConfiguration(),
new FragmentConfiguration(), new EnvConfiguration()});
context.setContextPath("/");
context.setParentLoaderPriority(true);
server.setHandler(context);
try {
server.start();
server.dump(System.err);
server.join();
} catch (Exception e) {
}
}
}
How do I read the context parameters set in web.xml file?