Package org.springframework.web.servlet.mvc.condition

Examples of org.springframework.web.servlet.mvc.condition.PatternsRequestCondition


    for (String pattern : defaultPatterns) {
      patterns[i] = getPath(pattern);
      paths.add(pattern);
      i++;
    }
    PatternsRequestCondition patternsInfo = new PatternsRequestCondition(patterns, getUrlPathHelper(),
        getPathMatcher(), useSuffixPatternMatch(), useTrailingSlashMatch(), getFileExtensions());

    ParamsRequestCondition paramsInfo = defaultMapping.getParamsCondition();
    if (!approvalParameter.equals(OAuth2Utils.USER_OAUTH_APPROVAL) && defaultPatterns.contains("/oauth/authorize")) {
      String[] params = new String[paramsInfo.getExpressions().size()];
View Full Code Here


   */
  protected RequestMappingInfo createRequestMappingInfo(RequestMapping annotation, RequestCondition<?> customCondition) {
    String[] patterns = resolveEmbeddedValuesInPatterns(annotation.value());
    return new RequestMappingInfo(
        annotation.name(),
        new PatternsRequestCondition(patterns, getUrlPathHelper(), getPathMatcher(),
            this.useSuffixPatternMatch, this.useTrailingSlashMatch, this.fileExtensions),
        new RequestMethodsRequestCondition(annotation.method()),
        new ParamsRequestCondition(annotation.params()),
        new HeadersRequestCondition(annotation.headers()),
        new ConsumesRequestCondition(annotation.consumes(), annotation.headers()),
View Full Code Here

  public RequestMappingInfo(String name, PatternsRequestCondition patterns, RequestMethodsRequestCondition methods,
      ParamsRequestCondition params, HeadersRequestCondition headers, ConsumesRequestCondition consumes,
      ProducesRequestCondition produces, RequestCondition<?> custom) {

    this.name = (StringUtils.hasText(name) ? name : null);
    this.patternsCondition = (patterns != null ? patterns : new PatternsRequestCondition());
    this.methodsCondition = (methods != null ? methods : new RequestMethodsRequestCondition());
    this.paramsCondition = (params != null ? params : new ParamsRequestCondition());
    this.headersCondition = (headers != null ? headers : new HeadersRequestCondition());
    this.consumesCondition = (consumes != null ? consumes : new ConsumesRequestCondition());
    this.producesCondition = (produces != null ? produces : new ProducesRequestCondition());
View Full Code Here

   * @return a new request mapping info instance; never {@code null}
   */
  @Override
  public RequestMappingInfo combine(RequestMappingInfo other) {
    String name = combineNames(other);
    PatternsRequestCondition patterns = this.patternsCondition.combine(other.patternsCondition);
    RequestMethodsRequestCondition methods = this.methodsCondition.combine(other.methodsCondition);
    ParamsRequestCondition params = this.paramsCondition.combine(other.paramsCondition);
    HeadersRequestCondition headers = this.headersCondition.combine(other.headersCondition);
    ConsumesRequestCondition consumes = this.consumesCondition.combine(other.consumesCondition);
    ProducesRequestCondition produces = this.producesCondition.combine(other.producesCondition);
View Full Code Here

    if (methods == null || params == null || headers == null || consumes == null || produces == null) {
      return null;
    }

    PatternsRequestCondition patterns = this.patternsCondition.getMatchingCondition(request);
    if (patterns == null) {
      return null;
    }

    RequestConditionHolder custom = this.customConditionHolder.getMatchingCondition(request);
View Full Code Here

  @Test
  public void matchPatternsCondition() {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");

    RequestMappingInfo info = new RequestMappingInfo(
        new PatternsRequestCondition("/foo*", "/bar"), null, null, null, null, null, null);
    RequestMappingInfo expected = new RequestMappingInfo(
        new PatternsRequestCondition("/foo*"), null, null, null, null, null, null);

    assertEquals(expected, info.getMatchingCondition(request));

    info = new RequestMappingInfo(
        new PatternsRequestCondition("/**", "/foo*", "/foo"), null, null, null, null, null, null);
    expected = new RequestMappingInfo(
        new PatternsRequestCondition("/foo", "/foo*", "/**"), null, null, null, null, null, null);

    assertEquals(expected, info.getMatchingCondition(request));
  }
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
    request.setParameter("foo", "bar");

    RequestMappingInfo info =
        new RequestMappingInfo(
            new PatternsRequestCondition("/foo"), null,
            new ParamsRequestCondition("foo=bar"), null, null, null, null);
    RequestMappingInfo match = info.getMatchingCondition(request);

    assertNotNull(match);

    info = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"), null,
        new ParamsRequestCondition("foo!=bar"), null, null, null, null);
    match = info.getMatchingCondition(request);

    assertNull(match);
  }
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
    request.addHeader("foo", "bar");

    RequestMappingInfo info =
        new RequestMappingInfo(
            new PatternsRequestCondition("/foo"), null, null,
            new HeadersRequestCondition("foo=bar"), null, null, null);
    RequestMappingInfo match = info.getMatchingCondition(request);

    assertNotNull(match);

    info = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"), null, null,
        new HeadersRequestCondition("foo!=bar"), null, null, null);
    match = info.getMatchingCondition(request);

    assertNull(match);
  }
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
    request.setContentType("text/plain");

    RequestMappingInfo info =
      new RequestMappingInfo(
        new PatternsRequestCondition("/foo"), null, null, null,
        new ConsumesRequestCondition("text/plain"), null, null);
    RequestMappingInfo match = info.getMatchingCondition(request);

    assertNotNull(match);

    info = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"), null, null, null,
        new ConsumesRequestCondition("application/xml"), null, null);
    match = info.getMatchingCondition(request);

    assertNull(match);
  }
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo");
    request.addHeader("Accept", "text/plain");

    RequestMappingInfo info =
      new RequestMappingInfo(
          new PatternsRequestCondition("/foo"), null, null, null, null,
          new ProducesRequestCondition("text/plain"), null);
    RequestMappingInfo match = info.getMatchingCondition(request);

    assertNotNull(match);

    info = new RequestMappingInfo(
        new PatternsRequestCondition("/foo"), null, null, null, null,
        new ProducesRequestCondition("application/xml"), null);
    match = info.getMatchingCondition(request);

    assertNull(match);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.mvc.condition.PatternsRequestCondition

Copyright © 2018 www.massapicom. 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.