}
// Expose model attributes as session attributes, if required.
Map<String, Object> model = (mav != null ? mav.getModel() : implicitModel);
Set<Object> sessionAttributeSet = new HashSet<Object>();
sessionAttributeSet.addAll(Arrays.asList(sessionAttributes.value()));
sessionAttributeSet.addAll(Arrays.asList(sessionAttributes.types()));
for (Map.Entry entry : new HashSet<Map.Entry>(model.entrySet())) {
String attrName = (String) entry.getKey();
Object attrValue = entry.getValue();
if (sessionAttributeSet.contains(attrName) ||
(attrValue != null && sessionAttributeSet.contains(attrValue.getClass()))) {