1 17 package org.apache.geronimo.jetty; 18 19 import java.util.Map ; 20 21 import org.apache.geronimo.gbean.GBeanInfo; 22 import org.apache.geronimo.gbean.GBeanInfoBuilder; 23 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 24 import org.mortbay.jetty.servlet.FilterHolder; 25 import org.mortbay.jetty.servlet.WebApplicationHandler; 26 27 30 public class JettyFilterHolder extends FilterHolder { 31 32 public JettyFilterHolder() { 34 } 35 36 public JettyFilterHolder(String filterName, String filterClass, Map initParams, JettyServletRegistration jettyServletRegistration) throws Exception { 37 super(jettyServletRegistration == null? null: jettyServletRegistration.getServletHandler(), filterName, filterClass); 38 if (jettyServletRegistration != null) { 39 ((WebApplicationHandler)jettyServletRegistration.getServletHandler()).addFilterHolder(this); 40 putAll(initParams); 41 start(); 42 } 43 } 44 45 public String getFilterName() { 46 return getName(); 47 } 48 49 public static final GBeanInfo GBEAN_INFO; 50 51 static { 52 GBeanInfoBuilder infoBuilder = new GBeanInfoBuilder(JettyFilterHolder.class, NameFactory.WEB_FILTER); 53 infoBuilder.addAttribute("filterName", String .class, true); 54 infoBuilder.addAttribute("filterClass", String .class, true); 55 infoBuilder.addAttribute("initParams", Map .class, true); 56 57 infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class, NameFactory.WEB_MODULE); 58 59 infoBuilder.setConstructor(new String [] {"filterName", "filterClass", "initParams", "JettyServletRegistration"}); 60 61 GBEAN_INFO = infoBuilder.getBeanInfo(); 62 63 } 64 65 public static GBeanInfo getGBeanInfo() { 66 return GBEAN_INFO; 67 } 68 69 } 70 | Popular Tags |