public PartialMatchHelper(Set<RequestMappingInfo> infos, HttpServletRequest request) { for (RequestMappingInfo info : infos) { if (info.getPatternsCondition().getMatchingCondition(request) != null) { this.partialMatches.add(new PartialMatch(info, request)); } } }
/** * Return declared "params" conditions but only among those that also * match the "methods", "consumes", and "params" conditions. */ public List<String[]> getParamConditions() { List<String[]> result = new ArrayList<>(); for (PartialMatch match : this.partialMatches) { if (match.hasProducesMatch()) { Set<NameValueExpression<String>> set = match.getInfo().getParamsCondition().getExpressions(); if (!CollectionUtils.isEmpty(set)) { int i = 0; String[] array = new String[set.size()]; for (NameValueExpression<String> expression : set) { array[i++] = expression.toString(); } result.add(array); } } } return result; }
/** * Return declared "producible" types but only among those that also * match the "methods" and "consumes" conditions. */ public Set<MediaType> getProducibleMediaTypes() { Set<MediaType> result = new LinkedHashSet<>(); for (PartialMatch match : this.partialMatches) { if (match.hasConsumesMatch()) { result.addAll(match.getInfo().getProducesCondition().getProducibleMediaTypes()); } } return result; }
/** * Return declared "params" conditions but only among those that also * match the "methods", "consumes", and "params" conditions. */ public List<String[]> getParamConditions() { List<String[]> result = new ArrayList<String[]>(); for (PartialMatch match : this.partialMatches) { if (match.hasProducesMatch()) { Set<NameValueExpression<String>> set = match.getInfo().getParamsCondition().getExpressions(); if (!CollectionUtils.isEmpty(set)) { int i = 0; String[] array = new String[set.size()]; for (NameValueExpression<String> expression : set) { array[i++] = expression.toString(); } result.add(array); } } } return result; }
public boolean hasProducesMatch() { return (hasConsumesMatch() && this.producesMatch); }
public boolean hasConsumesMatch() { return (hasMethodsMatch() && this.consumesMatch); }
public boolean hasParamsMatch() { return (hasProducesMatch() && this.paramsMatch); }
/** * Return declared "producible" types but only among those that also * match the "methods" and "consumes" conditions. */ public Set<MediaType> getProducibleMediaTypes() { Set<MediaType> result = new LinkedHashSet<MediaType>(); for (PartialMatch match : this.partialMatches) { if (match.hasConsumesMatch()) { result.addAll(match.getInfo().getProducesCondition().getProducibleMediaTypes()); } } return result; }
/** * Return declared "consumable" types but only among those that also * match the "methods" condition. */ public Set<MediaType> getConsumableMediaTypes() { Set<MediaType> result = new LinkedHashSet<MediaType>(); for (PartialMatch match : this.partialMatches) { if (match.hasMethodsMatch()) { result.addAll(match.getInfo().getConsumesCondition().getConsumableMediaTypes()); } } return result; }
/** * Return declared HTTP methods. */ public Set<String> getAllowedMethods() { Set<String> result = new LinkedHashSet<String>(); for (PartialMatch match : this.partialMatches) { for (RequestMethod method : match.getInfo().getMethodsCondition().getMethods()) { result.add(method.name()); } } return result; }
/** * Any partial matches for "methods", "consumes", "produces", and "params"? */ public boolean hasParamsMismatch() { for (PartialMatch match : this.partialMatches) { if (match.hasParamsMatch()) { return false; } } return true; }
/** * Any partial matches for "methods"? */ public boolean hasMethodsMismatch() { for (PartialMatch match : this.partialMatches) { if (match.hasMethodsMatch()) { return false; } } return true; }
/** * Any partial matches for "methods", "consumes", and "produces"? */ public boolean hasProducesMismatch() { for (PartialMatch match : this.partialMatches) { if (match.hasProducesMatch()) { return false; } } return true; }
/** * Any partial matches for "methods" and "consumes"? */ public boolean hasConsumesMismatch() { for (PartialMatch match : this.partialMatches) { if (match.hasConsumesMatch()) { return false; } } return true; }
public PartialMatchHelper(Set<RequestMappingInfo> infos, HttpServletRequest request) { for (RequestMappingInfo info : infos) { if (info.getPatternsCondition().getMatchingCondition(request) != null) { this.partialMatches.add(new PartialMatch(info, request)); } } }
public boolean hasProducesMatch() { return (hasConsumesMatch() && this.producesMatch); }
public boolean hasParamsMatch() { return (hasProducesMatch() && this.paramsMatch); }
public boolean hasConsumesMatch() { return (hasMethodsMatch() && this.consumesMatch); }
/** * Return declared "consumable" types but only among those that also * match the "methods" condition. */ public Set<MediaType> getConsumableMediaTypes() { Set<MediaType> result = new LinkedHashSet<>(); for (PartialMatch match : this.partialMatches) { if (match.hasMethodsMatch()) { result.addAll(match.getInfo().getConsumesCondition().getConsumableMediaTypes()); } } return result; }
/** * Any partial matches for "methods" and "consumes"? */ public boolean hasConsumesMismatch() { for (PartialMatch match : this.partialMatches) { if (match.hasConsumesMatch()) { return false; } } return true; }