コード例 #1
0
  @Override
  protected RequestMappingInfo createRequestMappingInfo(
      RequestMapping annotation, RequestCondition<?> customCondition) {
    String[] patterns = resolveEmbeddedValuesInPatterns(annotation.value());
    RequestMethod[] methods = annotation.method();

    // BPC的默认方法为POST
    if (methods == null || methods.length <= 0) {
      methods = new RequestMethod[] {RequestMethod.POST};
    }

    return new RequestMappingInfo(
        annotation.name(),
        new PatternsRequestCondition(
            patterns,
            getUrlPathHelper(),
            getPathMatcher(),
            this.useSuffixPatternMatch(),
            this.useTrailingSlashMatch(),
            this.getFileExtensions()),
        new RequestMethodsRequestCondition(methods),
        new ParamsRequestCondition(annotation.params()),
        new HeadersRequestCondition(annotation.headers()),
        new ConsumesRequestCondition(annotation.consumes(), annotation.headers()),
        new ProducesRequestCondition(
            annotation.produces(), annotation.headers(), this.getContentNegotiationManager()),
        customCondition);
  }
コード例 #2
0
 /** Created a RequestMappingInfo from a RequestMapping annotation. */
 private RequestMappingInfo createRequestMappingInfo(
     RequestMapping annotation, RequestCondition<?> customCondition) {
   return new RequestMappingInfo(
       new PatternsRequestCondition(
           annotation.value(),
           getUrlPathHelper(),
           getPathMatcher(),
           this.useSuffixPatternMatch,
           this.useTrailingSlashMatch),
       new RequestMethodsRequestCondition(annotation.method()),
       new ParamsRequestCondition(annotation.params()),
       new HeadersRequestCondition(annotation.headers()),
       new ConsumesRequestCondition(annotation.consumes(), annotation.headers()),
       new ProducesRequestCondition(annotation.produces(), annotation.headers()),
       customCondition);
 }