public void contextInitialized(ServletContextEvent sce) { final ServletContext app = sce.getServletContext(); final Configuration conf = NutchConfiguration.get(app); LOG.info("creating new bean"); NutchBean bean = null; try { bean = new NutchBean(conf); app.setAttribute(KEY, bean); } catch (final IOException ex) { LOG.error(StringUtils.stringifyException(ex)); } }
/** * Receives notification that the web application initialization process is starting. * * @param sce The servlet context event */ public void contextInitialized(ServletContextEvent sce) { sce.getServletContext().setInitParameter("aaa", "bbb"); }