¡@

Home 

java Programming Glossary: servletcontextevent

How to properly stop the Thread in Java

http://stackoverflow.com/questions/10961714/how-to-properly-stop-the-thread-in-java

thread null @Override public void contextInitialized ServletContextEvent event thread new Thread new IndexProcessor LOGGER.debug Starting.. started. @Override public void contextDestroyed ServletContextEvent event LOGGER.debug Stopping thread thread if thread null thread.interrupt.. runnable null @Override public void contextInitialized ServletContextEvent event runnable new IndexProcessor thread new Thread runnable..

How to loop through a HashMap in JSP?

http://stackoverflow.com/questions/1835683/how-to-loop-through-a-hashmap-in-jsp

once and kept in memory public void contextInitialized ServletContextEvent event Map String String countries MainUtils.getCountries event.getServletContext..

JSF initialize application-scope bean when context initialized

http://stackoverflow.com/questions/315073/jsf-initialize-application-scope-bean-when-context-initialized

static final String FOO foo public void contextInitialized ServletContextEvent event MyObject myObject new MyObject event.getServletContext.. .setAttribute FOO myObject public void contextDestroyed ServletContextEvent event MyObject myObject MyObject event.getServletContext .getAttribute..

How do I force an application-scoped bean to instantiate at application startup?

http://stackoverflow.com/questions/3600534/how-do-i-force-an-application-scoped-bean-to-instantiate-at-application-startup

methods . This should do public void contextInitialized ServletContextEvent event event.getServletContext .setAttribute bean new Bean where..

How to reference constants in EL?

http://stackoverflow.com/questions/3732608/how-to-reference-constants-in-el

@Override public void contextInitialized ServletContextEvent event JspFactory.getDefaultFactory .getJspApplicationContext..

How to run a background task in a servlet application?

http://stackoverflow.com/questions/4691132/how-to-run-a-background-task-in-a-servlet-application

scheduler @Override public void contextInitialized ServletContextEvent event scheduler Executors.newSingleThreadScheduledExecutor scheduler.scheduleAtFixedRate.. 0 1 TimeUnit.DAYS @Override public void contextDestroyed ServletContextEvent event scheduler.shutdownNow Where the class UpdateCounts look..

Spring - Injecting a dependency into a ServletContextListener

http://stackoverflow.com/questions/4746041/spring-injecting-a-dependency-into-a-servletcontextlistener

javax.servlet.ServletContextEvent @Override public void contextInitialized ServletContextEvent.. @Override public void contextInitialized ServletContextEvent event System.out.println Initialising listener... System.out.println.. prop @Override public void contextDestroyed ServletContextEvent event public void setProp String val System.out.println set..

Running a background Java program in Tomcat

http://stackoverflow.com/questions/4907502/running-a-background-java-program-in-tomcat

ExecutorService executor public void contextInitialized ServletContextEvent arg0 ServletContext context arg0.getServletContext int nr_executors.. MY_EXECUTOR executor public void contextDestroyed ServletContextEvent arg0 ServletContext context arg0.getServletContext executor.shutdownNow..

Java EE Enterprise Application: perform some action on deploy/startup

http://stackoverflow.com/questions/6120831/java-ee-enterprise-application-perform-some-action-on-deploy-startup

web app package com.someCompany import javax.servlet.ServletContextEvent import javax.servlet.ServletContextListener public class AppNameServletContextListener.. @Override public void contextDestroyed ServletContextEvent arg0 System.out.println ServletContextListener destroyed @Override.. destroyed @Override public void contextInitialized ServletContextEvent arg0 System.out.println ServletContextListener started do the..

Background Thread for a Tomcat servlet app

http://stackoverflow.com/questions/791986/background-thread-for-a-tomcat-servlet-app

MyThreadClass myThread null public void contextInitialized ServletContextEvent sce if myThread null myThread.isAlive myThread new MyThreadClass.. myThread.start public void contextDestroyed ServletContextEvent sce try myThread.doShutdown myThread.interrupt catch Exception..