public ZuulFilter getFilter ( String sCode , String sName ) throws Exception { if ( filterCheck . get ( sName ) == null ) { filterCheck . putIfAbsent ( sName , sName ) ; if ( ! sCode . equals ( filterClassCode . get ( sName ) ) ) { LOG . info ( "reloading code " + sName ) ; filterRegistry . remove ( sName ) ; } } ZuulFilter filter = filterRegistry . get ( sName ) ; if ( filter == null ) { Class clazz = compiler . compile ( sCode , sName ) ; if ( ! Modifier . isAbstract ( clazz . getModifiers ( ) ) ) { filter = filterFactory . newInstance ( clazz ) ; } } return filter ; }
Given source and name will compile and store the filter if it detects that the filter code has changed or the filter doesn t exist . Otherwise it will return an instance of the requested ZuulFilter