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

Examples of org.springframework.web.servlet.mvc.condition.ParamsRequestCondition$ParamExpression


  private RequestMappingInfo createRequestMappingInfo(RequestMapping annotation, RequestCondition<?> customCondition) {
    return new RequestMappingInfo(
        new PatternsRequestCondition(annotation.value(), 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()),
        new ProducesRequestCondition(annotation.produces(), annotation.headers(), getContentNegotiationManager()),
        customCondition);
  }
View Full Code Here


  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);
  }
View Full Code Here

                ConsumesRequestCondition consumes,
                ProducesRequestCondition produces,
                RequestCondition<?> custom) {
    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();
    this.customConditionHolder = new RequestConditionHolder(custom);
  }
View Full Code Here

   * @return a new request mapping info instance; never {@code null}
   */
  public RequestMappingInfo combine(RequestMappingInfo 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);
    RequestConditionHolder custom = this.customConditionHolder.combine(other.customConditionHolder);

View Full Code Here

   * the current request, sorted with best matching patterns on top.
   * @return a new instance in case all conditions match; or {@code null} otherwise
   */
  public RequestMappingInfo getMatchingCondition(HttpServletRequest request) {
    RequestMethodsRequestCondition methods = methodsCondition.getMatchingCondition(request);
    ParamsRequestCondition params = paramsCondition.getMatchingCondition(request);
    HeadersRequestCondition headers = headersCondition.getMatchingCondition(request);
    ConsumesRequestCondition consumes = consumesCondition.getMatchingCondition(request);
    ProducesRequestCondition produces = producesCondition.getMatchingCondition(request);
   
    if (methods == null || params == null || headers == null || consumes == null || produces == null) {
View Full Code Here

import static scala.collection.JavaConversions.*;

public class OperationParameterRequestConditionReader implements RequestMappingReader {
  @Override
  public void execute(RequestMappingContext context) {
    ParamsRequestCondition paramsCondition = context.getRequestMappingInfo().getParamsCondition();
    List<Parameter> parameters = (List<Parameter>) context.get("parameters");
    for (NameValueExpression<String> expression : paramsCondition.getExpressions()) {
      if (expression.isNegated() || any(nullToEmptyList(parameters),
              withName(expression.getName()))) {
        continue;
      }
      Parameter parameter = new Parameter(
View Full Code Here

      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()];
      Set<NameValueExpression<String>> expressions = paramsInfo.getExpressions();
      i = 0;
      for (NameValueExpression<String> expression : expressions) {
        String param = expression.toString();
        if (OAuth2Utils.USER_OAUTH_APPROVAL.equals(param)) {
          params[i] = approvalParameter;
        }
        else {
          params[i] = param;
        }
        i++;
      }
      paramsInfo = new ParamsRequestCondition(params);
    }

    RequestMappingInfo mapping = new RequestMappingInfo(patternsInfo, defaultMapping.getMethodsCondition(),
        paramsInfo, defaultMapping.getHeadersCondition(), defaultMapping.getConsumesCondition(),
        defaultMapping.getProducesCondition(), defaultMapping.getCustomCondition());
View Full Code Here

    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()),
        new ProducesRequestCondition(annotation.produces(), annotation.headers(), this.contentNegotiationManager),
        customCondition);
  }
View Full Code Here

    return result;
  }

  private Set<String> getRequestParams(HttpServletRequest request, Set<RequestMappingInfo> partialMatches) {
    for (RequestMappingInfo partialMatch : partialMatches) {
      ParamsRequestCondition condition = partialMatch.getParamsCondition();
      if (!CollectionUtils.isEmpty(condition.getExpressions()) && (condition.getMatchingCondition(request) == null)) {
        Set<String> expressions = new HashSet<String>();
        for (NameValueExpression<String> expr : condition.getExpressions()) {
          expressions.add(expr.toString());
        }
        return expressions;
      }
    }
View Full Code Here

      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());
    this.customConditionHolder = new RequestConditionHolder(custom);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.mvc.condition.ParamsRequestCondition$ParamExpression

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.