Package sorcerer

Source Code of sorcerer.WebAppMain

package sorcerer;

import org.jvnet.sorcerer.Analyzer;
import org.jvnet.sorcerer.stapler.Sorcerer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.io.File;
import java.io.IOException;

/**
* @author Kohsuke Kawaguchi
*/
public class WebAppMain implements ServletContextListener {

    public void contextInitialized(ServletContextEvent servletContextEvent) {
        try {
            Analyzer a = new Analyzer();
            a.addSourceFolder(new File("src/main/java/demo"));

            Sorcerer app = new Sorcerer(a.analyze());

            servletContextEvent.getServletContext().setAttribute("app",app);
        } catch (IOException e) {
            throw new Error(e);
        }
    }

    public void contextDestroyed(ServletContextEvent servletContextEvent) {
    }
}
TOP

Related Classes of sorcerer.WebAppMain

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.