コード例 #1
0
 public final void contextDestroyed(ServletContextEvent sce) {
   try {
     application.passivate();
   } catch (Exception e) {
     throw new IllegalStateException(e);
   }
 }
コード例 #2
0
  public final void contextInitialized(ServletContextEvent sce) {
    LOG.info("Qi4j Plugin: Initializing");

    ServletContext context = sce.getServletContext();
    application = createNewApplication(context);

    if (application != null) {
      Module module = qi4jStrutsModule(application);
      context.setAttribute(SERVLET_ATTRIBUTE, module);

      try {
        application.activate();
      } catch (Exception e) {
        throw new IllegalStateException(e);
      }
    } else {
      throw new IllegalStateException(
          "None of the assembly creation methods returned a non-null assembler");
    }
    LOG.info("... initialized qi4j-struts integration successfully");
  }