Consistent formatting
This commit is contained in:
@@ -123,7 +123,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
|
||||
@Override
|
||||
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
|
||||
String lookupPath = this.urlPathHelper.getLookupPathForRequest(request);
|
||||
for(Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) {
|
||||
for (Map.Entry<String, CorsConfiguration> entry : this.corsConfigurations.entrySet()) {
|
||||
if (this.pathMatcher.match(entry.getKey(), lookupPath)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
|
||||
@@ -48,9 +48,8 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
* Assist with initialization of the {@link Model} before controller method
|
||||
* invocation and with updates to it after the invocation.
|
||||
*
|
||||
* <p>On initialization the model is populated with attributes temporarily
|
||||
* stored in the session and through the invocation of {@code @ModelAttribute}
|
||||
* methods.
|
||||
* <p>On initialization the model is populated with attributes temporarily stored
|
||||
* in the session and through the invocation of {@code @ModelAttribute} methods.
|
||||
*
|
||||
* <p>On update model attributes are synchronized with the session and also
|
||||
* {@link BindingResult} attributes are added if missing.
|
||||
@@ -62,7 +61,6 @@ public final class ModelFactory {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ModelFactory.class);
|
||||
|
||||
|
||||
private final List<ModelMethod> modelMethods = new ArrayList<ModelMethod>();
|
||||
|
||||
private final WebDataBinderFactory dataBinderFactory;
|
||||
@@ -92,11 +90,11 @@ public final class ModelFactory {
|
||||
/**
|
||||
* Populate the model in the following order:
|
||||
* <ol>
|
||||
* <li>Retrieve "known" session attributes listed as {@code @SessionAttributes}.
|
||||
* <li>Invoke {@code @ModelAttribute} methods
|
||||
* <li>Find {@code @ModelAttribute} method arguments also listed as
|
||||
* {@code @SessionAttributes} and ensure they're present in the model raising
|
||||
* an exception if necessary.
|
||||
* <li>Retrieve "known" session attributes listed as {@code @SessionAttributes}.
|
||||
* <li>Invoke {@code @ModelAttribute} methods
|
||||
* <li>Find {@code @ModelAttribute} method arguments also listed as
|
||||
* {@code @SessionAttributes} and ensure they're present in the model raising
|
||||
* an exception if necessary.
|
||||
* </ol>
|
||||
* @param request the current request
|
||||
* @param container a container with the model to be initialized
|
||||
@@ -108,15 +106,13 @@ public final class ModelFactory {
|
||||
|
||||
Map<String, ?> sessionAttributes = this.sessionAttributesHandler.retrieveAttributes(request);
|
||||
container.mergeAttributes(sessionAttributes);
|
||||
|
||||
invokeModelAttributeMethods(request, container);
|
||||
|
||||
for (String name : findSessionAttributeArguments(handlerMethod)) {
|
||||
if (!container.containsAttribute(name)) {
|
||||
Object value = this.sessionAttributesHandler.retrieveAttribute(request, name);
|
||||
if (value == null) {
|
||||
throw new HttpSessionRequiredException(
|
||||
"Expected session attribute '" + name + "'");
|
||||
throw new HttpSessionRequiredException("Expected session attribute '" + name + "'");
|
||||
}
|
||||
container.addAttribute(name, value);
|
||||
}
|
||||
@@ -127,8 +123,8 @@ public final class ModelFactory {
|
||||
* Invoke model attribute methods to populate the model.
|
||||
* Attributes are added only if not already present in the model.
|
||||
*/
|
||||
private void invokeModelAttributeMethods(NativeWebRequest request,
|
||||
ModelAndViewContainer container) throws Exception {
|
||||
private void invokeModelAttributeMethods(NativeWebRequest request, ModelAndViewContainer container)
|
||||
throws Exception {
|
||||
|
||||
while (!this.modelMethods.isEmpty()) {
|
||||
InvocableHandlerMethod modelMethod = getNextModelMethod(container).getHandlerMethod();
|
||||
@@ -141,7 +137,6 @@ public final class ModelFactory {
|
||||
}
|
||||
|
||||
Object returnValue = modelMethod.invokeForRequest(request, container);
|
||||
|
||||
if (!modelMethod.isVoid()){
|
||||
String returnValueName = getNameForReturnValue(returnValue, modelMethod.getReturnType());
|
||||
if (!ann.binding()) {
|
||||
@@ -291,7 +286,6 @@ public final class ModelFactory {
|
||||
|
||||
private final Set<String> dependencies = new HashSet<String>();
|
||||
|
||||
|
||||
private ModelMethod(InvocableHandlerMethod handlerMethod) {
|
||||
this.handlerMethod = handlerMethod;
|
||||
for (MethodParameter parameter : handlerMethod.getMethodParameters()) {
|
||||
|
||||
@@ -288,7 +288,7 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||
return;
|
||||
}
|
||||
int length = source.length();
|
||||
for (int i=0; i < length; i++) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
char ch = source.charAt(i);
|
||||
if (ch == '%') {
|
||||
if ((i + 2) < length) {
|
||||
|
||||
Reference in New Issue
Block a user