1 29 30 package com.caucho.server.dispatch; 31 32 import com.caucho.config.Config; 33 import com.caucho.config.ConfigException; 34 import com.caucho.config.types.InitParam; 35 import com.caucho.config.types.InitProgram; 36 import com.caucho.server.util.CauchoSystem; 37 import com.caucho.util.L10N; 38 39 import javax.servlet.Filter ; 40 import javax.servlet.FilterConfig ; 41 import javax.servlet.ServletContext ; 42 import java.util.Collections ; 43 import java.util.Enumeration ; 44 import java.util.HashMap ; 45 import java.util.Map ; 46 47 50 public class FilterConfigImpl implements FilterConfig { 51 private static final L10N L = new L10N(FilterConfigImpl.class); 52 53 private String _filterName; 54 private String _filterClassName; 55 private Class _filterClass; 56 private String _displayName; 57 private HashMap <String ,String > _initParams = new HashMap <String ,String >(); 58 59 private InitProgram _init; 60 61 private ServletContext _servletContext; 62 63 66 public FilterConfigImpl() 67 { 68 } 69 70 public void setId(String id) 71 { 72 } 73 74 77 public void setFilterName(String name) 78 { 79 _filterName = name; 80 } 81 82 85 public String getFilterName() 86 { 87 return _filterName; 88 } 89 90 93 public void setFilterClass(String filterClassName) 94 throws ConfigException, ClassNotFoundException 95 { 96 _filterClassName = filterClassName; 97 98 _filterClass = CauchoSystem.loadClass(filterClassName); 99 100 Config.validate(_filterClass, Filter .class); 101 } 102 103 106 public Class getFilterClass() 107 { 108 return _filterClass; 109 } 110 111 114 public String getFilterClassName() 115 { 116 return _filterClassName; 117 } 118 119 122 public void setInitParam(String param, String value) 123 { 124 _initParams.put(param, value); 125 } 126 127 130 public void setInitParam(InitParam initParam) 131 { 132 _initParams.putAll(initParam.getParameters()); 133 } 134 135 138 public Map getInitParamMap() 139 { 140 return _initParams; 141 } 142 143 146 public String getInitParameter(String name) 147 { 148 return _initParams.get(name); 149 } 150 151 154 public Enumeration getInitParameterNames() 155 { 156 return Collections.enumeration(_initParams.keySet()); 157 } 158 159 162 public ServletContext getServletContext() 163 { 164 return _servletContext; 165 } 166 167 170 public void setServletContext(ServletContext app) 171 { 172 _servletContext = app; 173 } 174 175 178 public void setInit(InitProgram init) 179 { 180 _init = init; 181 } 182 183 186 public InitProgram getInit() 187 { 188 return _init; 189 } 190 191 194 public void setDisplayName(String displayName) 195 { 196 _displayName = displayName; 197 } 198 199 202 public String getDisplayName() 203 { 204 return _displayName; 205 } 206 207 210 public void setDescription(String description) 211 { 212 } 213 214 217 public void setIcon(String icon) 218 { 219 } 220 221 224 public String toString() 225 { 226 return "FilterConfigImpl[name=" + _filterName + ",class=" + _filterClass + "]"; 227 } 228 } 229 | Popular Tags |