Examples of MappedInterceptor


Examples of org.springframework.web.servlet.handler.MappedInterceptor

   */
  protected Object getInterceptor() {
    if (pathPatterns.isEmpty()) {
      return interceptor;
    }
    return new MappedInterceptor(pathPatterns.toArray(new String[pathPatterns.size()]), interceptor);
  }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

   */
  protected Object getInterceptor() {
    if (this.includePatterns.isEmpty()) {
      return this.interceptor;
    }
    return new MappedInterceptor(toArray(this.includePatterns), toArray(this.excludePatterns), interceptor);
  }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

            }

            HandlerInterceptor interceptor = new ConverterHandlerInterceptor(converter, returnTypeClass,
                    getResultsMethod, (setResultsMethod != null ? setResultsMethod : altSetResultsMethod.get()));

            MappedInterceptor mappedInterceptor = new MappedInterceptor(pathPatterns, interceptor);
            setInterceptors(new Object[]{ mappedInterceptor });

            logger.info("Registered converter post handler for {} with {}.", pathPatterns, converterClass.getCanonicalName());
        }
    }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

  /**
   * Add interceptors mapped to a set of path patterns.
   */
  public StandaloneMockMvcBuilder addMappedInterceptors(String[] pathPatterns, HandlerInterceptor... interceptors) {
    for (HandlerInterceptor interceptor : interceptors) {
      this.mappedInterceptors.add(new MappedInterceptor(pathPatterns, interceptor));
    }
    return this;
  }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

      return this.interceptor;
    }

    String[] include = toArray(this.includePatterns);
    String[] exclude = toArray(this.excludePatterns);
    MappedInterceptor mappedInterceptor = new MappedInterceptor(include, exclude, this.interceptor);

    if (this.pathMatcher != null) {
      mappedInterceptor.setPathMatcher(this.pathMatcher);
    }

    return mappedInterceptor;
  }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

    assertEquals(2, beanNameMapping.getOrder());

    ResourceUrlProvider urlProvider = appContext.getBean(ResourceUrlProvider.class);
    assertNotNull(urlProvider);

    MappedInterceptor mappedInterceptor = appContext.getBean(MappedInterceptor.class);
    assertNotNull(urlProvider);
    assertEquals(ResourceUrlProviderExposingInterceptor.class, mappedInterceptor.getInterceptor().getClass());

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI("/resources/foo.css");
    request.setMethod("GET");
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

  @Test
  public void mappedInterceptors() throws Exception {
    String path = "/foo";
    HandlerInterceptor interceptor = new HandlerInterceptorAdapter() {};
    MappedInterceptor mappedInterceptor = new MappedInterceptor(new String[] {path}, interceptor);

    TestRequestMappingInfoHandlerMapping hm = new TestRequestMappingInfoHandlerMapping();
    hm.registerHandler(new TestController());
    hm.setInterceptors(new Object[] { mappedInterceptor });
    hm.setApplicationContext(new StaticWebApplicationContext());
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

  @Test
  public void addInterceptorsWithCustomPathMatcher() {
    PathMatcher pathMatcher = Mockito.mock(PathMatcher.class);
    this.registry.addInterceptor(interceptor1).addPathPatterns("/path1/**").pathMatcher(pathMatcher);

    MappedInterceptor mappedInterceptor = (MappedInterceptor) this.registry.getInterceptors().get(0);
    assertSame(pathMatcher, mappedInterceptor.getPathMatcher());
  }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

  private List<HandlerInterceptor> getInterceptorsForPath(String lookupPath) {
    PathMatcher pathMatcher = new AntPathMatcher();
    List<HandlerInterceptor> result = new ArrayList<HandlerInterceptor>();
    for (Object interceptor : this.registry.getInterceptors()) {
      if (interceptor instanceof MappedInterceptor) {
        MappedInterceptor mappedInterceptor = (MappedInterceptor) interceptor;
        if (mappedInterceptor.matches(lookupPath, pathMatcher)) {
          result.add(mappedInterceptor.getInterceptor());
        }
      }
      else if (interceptor instanceof HandlerInterceptor) {
        result.add((HandlerInterceptor) interceptor);
      }
View Full Code Here

Examples of org.springframework.web.servlet.handler.MappedInterceptor

  /**
   * Add interceptors mapped to a set of path patterns.
   */
  public StandaloneMockMvcBuilder addMappedInterceptors(String[] pathPatterns, HandlerInterceptor... interceptors) {
    for (HandlerInterceptor interceptor : interceptors) {
      this.mappedInterceptors.add(new MappedInterceptor(pathPatterns, interceptor));
    }
    return this;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.