Created
October 23, 2014 15:04
-
-
Save avarabyeu/4bbfcbf8b84b818783bf to your computer and use it in GitHub Desktop.
Custom spark filter with ServletContextListener implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebFilter(urlPatterns = {"/*"}) | |
@WebListener | |
public class YourCustomFilter extends SparkFilter implements ServletContextListener { | |
@Override | |
protected SparkApplication getApplication(FilterConfig filterConfig) throws ServletException { | |
return //your SparkApplication; | |
} | |
@Override | |
public void contextInitialized(ServletContextEvent servletContextEvent) { | |
//startup stuff | |
} | |
@Override | |
public void contextDestroyed(ServletContextEvent servletContextEvent) { | |
//shutdown stuff | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment