private ServletContext getRequiredServletContext() {
        ServletContext servletContext = getServletContext();
        if (servletContext == null) {
            String msg = "ServletContext property must be set via the setServletContext method.";
            throw new IllegalStateException(msg);
        }
        return servletContext;
    }
Base implementation for any components that need to access the web application's {@link ServletContext ServletContext}.

@since 0.2
web/src/main/java/org/apache/shiro/web/servlet/ServletContextSupport.java