Example usage for org.springframework.web.servlet HandlerExecutionChain addInterceptor

List of usage examples for org.springframework.web.servlet HandlerExecutionChain addInterceptor

Introduction

In this page you can find the example usage for org.springframework.web.servlet HandlerExecutionChain addInterceptor.

Prototype

public void addInterceptor(HandlerInterceptor interceptor) 

Source Link

Usage

From source file:com.wesley_acheson.spring.BackingBeanUrlHandlerMapper.java

/**
 * Adds an inteceptor which adds the backing bean into the request to an
 * existing HandlerExecutionChain.//from ww  w. j a  v  a2  s . c  o  m
 * 
 * @param chain
 *            The chain which the backing bean is being added to.
 * @param bean
 *            The object to pass through to the controller.
 */
protected void addBackingBeanInteceptor(HandlerExecutionChain chain, Object bean) {
    chain.addInterceptor(new BackingBeanExposingInteceptor(bean));

}

From source file:com.nominanuda.springmvc.HandlerMatcherMapping.java

public HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception {
    HttpRequest httpRequest = servletHelper.getOrCreateRequest(request, true);
    ;/*w w  w  .j  av a2 s  .  c o  m*/
    Tuple2<Object, DataStruct> res = handlerMatcher.match(httpRequest);
    if (res == null) {
        return null;
    } else {
        Object h = res.get0();
        HandlerExecutionChain hec;
        if (h instanceof HandlerAndFilters) {
            HandlerAndFilters haf = (HandlerAndFilters) h;
            hec = new HandlerExecutionChain(haf.getHandler());
            for (HandlerFilter f : haf.getFilters()) {
                hec.addInterceptor(convert(f));
            }
        } else {
            hec = new HandlerExecutionChain(h);
        }
        servletHelper.storeCommand(request, res.get1());
        return hec;
    }
}