1 9 10 package com.opensymphony.module.sitemesh; 11 12 import javax.servlet.FilterConfig ; 13 import javax.servlet.ServletConfig ; 14 import javax.servlet.ServletContext ; 15 16 23 public class Config { 24 private ServletConfig servletConfig; 25 private FilterConfig filterConfig; 26 27 public Config(ServletConfig servletConfig) { 28 if (servletConfig == null) throw new NullPointerException ("ServletConfig cannot be null"); 29 this.servletConfig = servletConfig; 30 } 31 32 public Config(FilterConfig filterConfig) { 33 if (filterConfig == null) throw new NullPointerException ("FilterConfig cannot be null"); 34 this.filterConfig = filterConfig; 35 } 36 37 public ServletContext getServletContext() { 38 return servletConfig != null ? servletConfig.getServletContext() : filterConfig.getServletContext(); 39 } 40 } | Popular Tags |