Example usage for org.springframework.web.servlet.handler WebRequestHandlerInterceptorAdapter WebRequestHandlerInterceptorAdapter

List of usage examples for org.springframework.web.servlet.handler WebRequestHandlerInterceptorAdapter WebRequestHandlerInterceptorAdapter

Introduction

In this page you can find the example usage for org.springframework.web.servlet.handler WebRequestHandlerInterceptorAdapter WebRequestHandlerInterceptorAdapter.

Prototype

public WebRequestHandlerInterceptorAdapter(WebRequestInterceptor requestInterceptor) 

Source Link

Document

Create a new WebRequestHandlerInterceptorAdapter for the given WebRequestInterceptor.

Usage

From source file:org.codehaus.groovy.grails.web.util.WebUtils.java

/**
 * Looks up all of the HandlerInterceptor instances registered for the application
 *
 * @param servletContext The ServletContext instance
 * @return An array of HandlerInterceptor instances
 *///from   ww  w. j a va 2  s  .c o  m
public static HandlerInterceptor[] lookupHandlerInterceptors(ServletContext servletContext) {
    WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);

    final Collection<HandlerInterceptor> allHandlerInterceptors = new ArrayList<HandlerInterceptor>();

    WebRequestInterceptor[] webRequestInterceptors = lookupWebRequestInterceptors(servletContext);
    for (WebRequestInterceptor webRequestInterceptor : webRequestInterceptors) {
        allHandlerInterceptors.add(new WebRequestHandlerInterceptorAdapter(webRequestInterceptor));
    }
    final Collection<HandlerInterceptor> handlerInterceptors = wac.getBeansOfType(HandlerInterceptor.class)
            .values();

    allHandlerInterceptors.addAll(handlerInterceptors);
    return allHandlerInterceptors.toArray(new HandlerInterceptor[allHandlerInterceptors.size()]);
}