1 31 package org.blojsom.servlet; 32 33 import javax.servlet.ServletConfig ; 34 35 import org.springframework.beans.factory.config.AbstractFactoryBean; 36 37 44 public class ServletConfigFactoryBean extends AbstractFactoryBean { 45 46 private static ServletConfig servletConfig; 47 48 54 protected final Object createInstance() throws Exception { 55 verifyState(); 56 57 return servletConfig; 58 } 59 60 65 public final Class getObjectType() { 66 return ServletConfig .class; 67 } 68 69 74 public static void setServletConfig(ServletConfig servletConfig) { 75 ServletConfigFactoryBean.servletConfig = servletConfig; 76 } 77 78 83 protected final void verifyState() throws IllegalStateException { 84 if (servletConfig == null) { 85 throw new IllegalStateException ("You invoke the ServletConfigFactoryBean.setServletConfig() " + 86 "method prior to attempting to get the ServletConfig."); 87 } 88 } 89 } 90 91 | Popular Tags |