hudson.util.PluginServletFilter Java Examples

The following examples show how to use hudson.util.PluginServletFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceCacheControl.java    From blueocean-plugin with MIT License 6 votes vote down vote up
public static synchronized void install() {
    if (INSTANCE != null) {
        return;
    }
    INSTANCE = new ResourceCacheControl();

    // Don't add the filter if we are running with hpi:run. Otherwise, people need
    // to do a hard reload (bypassing the cache), which may confuse people during dev.
    if (!Boolean.getBoolean("hudson.hpi.run")) {
        try {
            // Add paths to resources that we want to set the
            // cache-control header.
            INSTANCE.addPath(Jenkins.RESOURCE_PATH); // "/static/VERSION" resources - e.g. JDL assets (fonts etc)
            INSTANCE.addPath(Jenkins.getInstance().getAdjuncts("").rootURL);

            PluginServletFilter.addFilter(INSTANCE);
        } catch (Exception e) {
            throw new IllegalStateException("Unexpected Exception installing Blue Web Resource Adjunct cache control filter.", e);
        }
    }
}
 
Example #2
Source File: RequestContextFilter.java    From audit-log-plugin with MIT License 4 votes vote down vote up
/**
 * Registering the filter
 */
@Initializer
public static void init() throws ServletException {
    PluginServletFilter.addFilter(new RequestContextFilter());
}
 
Example #3
Source File: JwtAuthenticationFilter.java    From blueocean-plugin with MIT License 4 votes vote down vote up
@Initializer(fatal=false)
public static void init() throws ServletException {
    PluginServletFilter.addFilter(new JwtAuthenticationFilter());
}
 
Example #4
Source File: Dispatcher.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
@Override
public void postInitialize() throws Exception {
    super.postInitialize();

    PluginServletFilter.addFilter(new LessCSS("/build-monitor-plugin/style.css", pathTo("less/index.less"), new StaticJenkinsAPIs()));
}