protected void defineFilter ( Context ctx , String name , String classname , Map < String , String > parameters , String [ ] urls ) { FilterHolder holder = new FilterHolder ( ) ; holder . setName ( name ) ; holder . setClassName ( classname ) ; holder . setInitParameters ( parameters ) ; FilterMapping fmap = new FilterMapping ( ) ; fmap . setPathSpecs ( urls ) ; fmap . setDispatches ( Handler . ALL ) ; fmap . setFilterName ( name ) ; ServletHandler handler = ctx . getServletHandler ( ) ; handler . addFilter ( holder , fmap ) ; }
Define a filter for a context and set up default url mappings .