Polishing

This commit is contained in:
Juergen Hoeller
2014-02-12 18:36:04 +01:00
parent 6f58491b9c
commit 0ec99fdef7
4 changed files with 26 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,6 +74,7 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
/** Whether or not the view should add path variables in the model */
private boolean exposePathVariables = true;
/**
* Set the view's name. Helpful for traceability.
* <p>Framework code must call this when constructing views.
@@ -244,9 +245,10 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
* Returns the value of the flag indicating whether path variables should be added to the model or not.
*/
public boolean isExposePathVariables() {
return exposePathVariables;
return this.exposePathVariables;
}
/**
* Prepares the view given the specified model, merging it with static
* attributes and a RequestContext attribute, if necessary.
@@ -261,7 +263,6 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
}
Map<String, Object> mergedModel = createMergedOutputModel(model, request, response);
prepareResponse(request, response);
renderMergedOutputModel(mergedModel, request, response);
}
@@ -271,11 +272,11 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
* Dynamic values take precedence over static attributes.
*/
protected Map<String, Object> createMergedOutputModel(Map<String, ?> model, HttpServletRequest request,
HttpServletResponse response) {
@SuppressWarnings("unchecked")
Map<String, Object> pathVars = this.exposePathVariables ?
(Map<String, Object>) request.getAttribute(View.PATH_VARIABLES) : null;
Map<String, Object> pathVars = (this.exposePathVariables ?
(Map<String, Object>) request.getAttribute(View.PATH_VARIABLES) : null);
// Consolidate static and dynamic model attributes.
int size = this.staticAttributes.size();