Search in sources :

Example 1 with HttpRequestFilter

use of com.gitblit.extensions.HttpRequestFilter in project gitblit by gitblit.

the class ProxyFilter method init.

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    filters.addAll(pluginManager.getExtensions(HttpRequestFilter.class));
    for (HttpRequestFilter f : filters) {
        // wrap the filter config for Gitblit settings retrieval
        PluginWrapper pluginWrapper = pluginManager.whichPlugin(f.getClass());
        FilterConfig runtimeConfig = new FilterRuntimeConfig(runtimeManager, pluginWrapper.getPluginId(), filterConfig);
        f.init(runtimeConfig);
    }
}
Also used : HttpRequestFilter(com.gitblit.extensions.HttpRequestFilter) PluginWrapper(ro.fortsoft.pf4j.PluginWrapper) FilterConfig(javax.servlet.FilterConfig)

Example 2 with HttpRequestFilter

use of com.gitblit.extensions.HttpRequestFilter in project gitblit by gitblit.

the class ProxyFilter method doFilter.

@Override
public void doFilter(ServletRequest req, ServletResponse res, final FilterChain last) throws IOException, ServletException {
    final Iterator<HttpRequestFilter> itr = filters.iterator();
    new FilterChain() {

        @Override
        public void doFilter(ServletRequest req, ServletResponse res) throws IOException, ServletException {
            if (itr.hasNext()) {
                itr.next().doFilter(req, res, this);
            } else {
                last.doFilter(req, res);
            }
        }
    }.doFilter(req, res);
}
Also used : ServletException(javax.servlet.ServletException) ServletRequest(javax.servlet.ServletRequest) ServletResponse(javax.servlet.ServletResponse) HttpRequestFilter(com.gitblit.extensions.HttpRequestFilter) FilterChain(javax.servlet.FilterChain) IOException(java.io.IOException)

Aggregations

HttpRequestFilter (com.gitblit.extensions.HttpRequestFilter)2 IOException (java.io.IOException)1 FilterChain (javax.servlet.FilterChain)1 FilterConfig (javax.servlet.FilterConfig)1 ServletException (javax.servlet.ServletException)1 ServletRequest (javax.servlet.ServletRequest)1 ServletResponse (javax.servlet.ServletResponse)1 PluginWrapper (ro.fortsoft.pf4j.PluginWrapper)1