Polishing

This commit is contained in:
Juergen Hoeller
2016-07-22 22:28:20 +02:00
parent e59a5993f3
commit 382a931e7d
4 changed files with 39 additions and 64 deletions

View File

@@ -65,7 +65,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
}
catch (NoSuchMethodException ex) {
// Should never happen
throw new IllegalStateException("No handler for HTTP OPTIONS", ex);
throw new IllegalStateException("Failed to retrieve internal handler method for HTTP OPTIONS", ex);
}
}
@@ -183,7 +183,6 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
/**
* Iterate all RequestMappingInfo's once again, look if any match by URL at
* least and raise exceptions according to what doesn't match.
*
* @throws HttpRequestMethodNotSupportedException if there are matches by URL
* but not by HTTP method
* @throws HttpMediaTypeNotAcceptableException if there are matches by URL
@@ -243,7 +242,6 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
private final List<PartialMatch> partialMatches = new ArrayList<>();
public PartialMatchHelper(Set<RequestMappingInfo> infos, HttpServletRequest request) {
for (RequestMappingInfo info : infos) {
if (info.getPatternsCondition().getMatchingCondition(request) != null) {
@@ -252,7 +250,6 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
}
}
/**
* Whether there any partial matches.
*/
@@ -387,20 +384,18 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
private final boolean paramsMatch;
/**
* @param info RequestMappingInfo that matches the URL path.
* @param request the current request
*/
public PartialMatch(RequestMappingInfo info, HttpServletRequest request) {
this.info = info;
this.methodsMatch = info.getMethodsCondition().getMatchingCondition(request) != null;
this.consumesMatch = info.getConsumesCondition().getMatchingCondition(request) != null;
this.producesMatch = info.getProducesCondition().getMatchingCondition(request) != null;
this.paramsMatch = info.getParamsCondition().getMatchingCondition(request) != null;
this.methodsMatch = (info.getMethodsCondition().getMatchingCondition(request) != null);
this.consumesMatch = (info.getConsumesCondition().getMatchingCondition(request) != null);
this.producesMatch = (info.getProducesCondition().getMatchingCondition(request) != null);
this.paramsMatch = (info.getParamsCondition().getMatchingCondition(request) != null);
}
public RequestMappingInfo getInfo() {
return this.info;
}
@@ -410,15 +405,15 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
}
public boolean hasConsumesMatch() {
return hasMethodsMatch() && this.consumesMatch;
return (hasMethodsMatch() && this.consumesMatch);
}
public boolean hasProducesMatch() {
return hasConsumesMatch() && this.producesMatch;
return (hasConsumesMatch() && this.producesMatch);
}
public boolean hasParamsMatch() {
return hasProducesMatch() && this.paramsMatch;
return (hasProducesMatch() && this.paramsMatch);
}
@Override
@@ -428,6 +423,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
}
}
/**
* Default handler for HTTP OPTIONS.
*/
@@ -435,7 +431,6 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
private final HttpHeaders headers = new HttpHeaders();
public HttpOptionsHandler(Set<String> declaredMethods) {
this.headers.setAllow(initAllowedHttpMethods(declaredMethods));
}