@Override protected AbstractUrlBasedView buildView(final String viewName) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Building view using multiple layout resolver. View name is {}", viewName); } VelocityLayoutView view = (VelocityLayoutView) super.buildView(viewName); if (layoutKey != null) { view.setLayoutKey(layoutKey); } if (screenContentKey != null) { view.setScreenContentKey(screenContentKey); } if (!this.mappings.isEmpty()) { for (Map.Entry<String, String> entry : this.mappings.entrySet()) { // Correct wildcards so that we can use the matches method in the String object String mappingRegexp = StringUtils.replace(entry.getKey(), "*", ".*"); // If the view matches the regexp mapping if (viewName.matches(mappingRegexp)) { if (logger.isDebugEnabled()) { logger.debug(" Found matching view. Setting layout url to {}", entry.getValue()); } view.setLayoutUrl(entry.getValue()); return view; } } } return view; }
@Override protected Class<?> requiredViewClass() { return VelocityLayoutView.class; }