|
Struts example source code file (StrutsOsgiListener.java)
The Struts StrutsOsgiListener.java source codepackage org.apache.struts2.osgi; import org.apache.struts2.StrutsException; import javax.servlet.ServletContextListener; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContext; /** * ServletContextListener that starts Apache Felix */ public class StrutsOsgiListener implements ServletContextListener { public static final String OSGI_HOST = "__struts_osgi_host"; private FelixOsgiHost osgiHost; public void contextInitialized(ServletContextEvent sce) { ServletContext servletContext = sce.getServletContext(); osgiHost = new FelixOsgiHost(); servletContext.setAttribute(OSGI_HOST, osgiHost); try { osgiHost.init(servletContext); } catch (Exception e) { throw new StrutsException("Apache Felix failed to start", e); } } public void contextDestroyed(ServletContextEvent sce) { try { osgiHost.destroy(); } catch (Exception e) { throw new StrutsException("Apache Felix failed to stop", e); } } } Other Struts examples (source code examples)Here is a short list of links related to this Struts StrutsOsgiListener.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.