Search in sources :

Example 1 with GroovyFileFilter

use of com.netflix.zuul.groovy.GroovyFileFilter in project zuul by Netflix.

the class StartServer method initZuul.

void initZuul() throws Exception, IllegalAccessException, InstantiationException {
    RequestContext.setContextClass(NFRequestContext.class);
    CounterFactory.initialize(new Counter());
    TracerFactory.initialize(new Tracer());
    LOG.info("Starting Groovy Filter file manager");
    final AbstractConfiguration config = ConfigurationManager.getConfigInstance();
    final String preFiltersPath = config.getString(ZUUL_FILTER_PRE_PATH);
    final String postFiltersPath = config.getString(ZUUL_FILTER_POST_PATH);
    final String routingFiltersPath = config.getString(ZUUL_FILTER_ROUTING_PATH);
    final String customPath = config.getString(ZUUL_FILTER_CUSTOM_PATH);
    FilterLoader.getInstance().setCompiler(new GroovyCompiler());
    FilterFileManager.setFilenameFilter(new GroovyFileFilter());
    if (customPath == null) {
        FilterFileManager.init(5, preFiltersPath, postFiltersPath, routingFiltersPath);
    } else {
        FilterFileManager.init(5, preFiltersPath, postFiltersPath, routingFiltersPath, customPath);
    }
    LOG.info("Groovy Filter file manager started");
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) GroovyCompiler(com.netflix.zuul.groovy.GroovyCompiler) Counter(com.netflix.zuul.plugins.Counter) GroovyFileFilter(com.netflix.zuul.groovy.GroovyFileFilter) Tracer(com.netflix.zuul.plugins.Tracer)

Example 2 with GroovyFileFilter

use of com.netflix.zuul.groovy.GroovyFileFilter in project zuul by Netflix.

the class StartServer method initGroovyFilterManager.

private void initGroovyFilterManager() {
    FilterLoader.getInstance().setCompiler(new GroovyCompiler());
    String scriptRoot = System.getProperty("zuul.filter.root", "");
    if (scriptRoot.length() > 0)
        scriptRoot = scriptRoot + File.separator;
    try {
        FilterFileManager.setFilenameFilter(new GroovyFileFilter());
        FilterFileManager.init(5, scriptRoot + "pre", scriptRoot + "route", scriptRoot + "post");
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : GroovyCompiler(com.netflix.zuul.groovy.GroovyCompiler) GroovyFileFilter(com.netflix.zuul.groovy.GroovyFileFilter)

Aggregations

GroovyCompiler (com.netflix.zuul.groovy.GroovyCompiler)2 GroovyFileFilter (com.netflix.zuul.groovy.GroovyFileFilter)2 Counter (com.netflix.zuul.plugins.Counter)1 Tracer (com.netflix.zuul.plugins.Tracer)1 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)1