Polishing (includes varargs for selected setters)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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.
|
||||
@@ -38,7 +38,7 @@ public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter
|
||||
* Set the roles that this interceptor should treat as authorized.
|
||||
* @param authorizedRoles array of role names
|
||||
*/
|
||||
public final void setAuthorizedRoles(String[] authorizedRoles) {
|
||||
public final void setAuthorizedRoles(String... authorizedRoles) {
|
||||
this.authorizedRoles = authorizedRoles;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -124,7 +124,7 @@ public class ParameterMethodNameResolver implements MethodNameResolver {
|
||||
* can be considered a logical name only.
|
||||
* @see #setParamName
|
||||
*/
|
||||
public void setMethodParamNames(String[] methodParamNames) {
|
||||
public void setMethodParamNames(String... methodParamNames) {
|
||||
this.methodParamNames = methodParamNames;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -38,7 +38,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
|
||||
private Set<String> excludedPackages = Collections.singleton("org.springframework.web.servlet.mvc");
|
||||
|
||||
private Set<Class> excludedClasses = Collections.emptySet();
|
||||
private Set<Class<?>> excludedClasses = Collections.emptySet();
|
||||
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
* e.g. a {@link org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping},
|
||||
* alongside this ControllerClassNameHandlerMapping for application controllers.
|
||||
*/
|
||||
public void setExcludedPackages(String[] excludedPackages) {
|
||||
public void setExcludedPackages(String... excludedPackages) {
|
||||
this.excludedPackages = (excludedPackages != null) ?
|
||||
new HashSet<String>(Arrays.asList(excludedPackages)) : new HashSet<String>();
|
||||
}
|
||||
@@ -69,9 +69,9 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
* Specify controller classes that should be excluded from this mapping.
|
||||
* Any such classes will simply be ignored by this HandlerMapping.
|
||||
*/
|
||||
public void setExcludedClasses(Class[] excludedClasses) {
|
||||
public void setExcludedClasses(Class<?>... excludedClasses) {
|
||||
this.excludedClasses = (excludedClasses != null) ?
|
||||
new HashSet<Class>(Arrays.asList(excludedClasses)) : new HashSet<Class>();
|
||||
new HashSet<Class<?>>(Arrays.asList(excludedClasses)) : new HashSet<Class<?>>();
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
*/
|
||||
@Override
|
||||
protected String[] determineUrlsForHandler(String beanName) {
|
||||
Class beanClass = getApplicationContext().getType(beanName);
|
||||
Class<?> beanClass = getApplicationContext().getType(beanName);
|
||||
if (isEligibleForMapping(beanName, beanClass)) {
|
||||
return buildUrlsForHandler(beanName, beanClass);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
* @see #setExcludedPackages
|
||||
* @see #setExcludedClasses
|
||||
*/
|
||||
protected boolean isEligibleForMapping(String beanName, Class beanClass) {
|
||||
protected boolean isEligibleForMapping(String beanName, Class<?> beanClass) {
|
||||
if (beanClass == null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Excluding controller bean '" + beanName + "' from class name mapping " +
|
||||
@@ -131,7 +131,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
* that is supported by this mapping strategy.
|
||||
* @param beanClass the class to introspect
|
||||
*/
|
||||
protected boolean isControllerType(Class beanClass) {
|
||||
protected boolean isControllerType(Class<?> beanClass) {
|
||||
return this.predicate.isControllerType(beanClass);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
* that dispatches to multiple action methods.
|
||||
* @param beanClass the class to introspect
|
||||
*/
|
||||
protected boolean isMultiActionControllerType(Class beanClass) {
|
||||
protected boolean isMultiActionControllerType(Class<?> beanClass) {
|
||||
return this.predicate.isMultiActionControllerType(beanClass);
|
||||
}
|
||||
|
||||
@@ -151,6 +151,6 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
|
||||
* @param beanClass the type of the bean
|
||||
* @return the URLs determined for the bean
|
||||
*/
|
||||
protected abstract String[] buildUrlsForHandler(String beanName, Class beanClass);
|
||||
protected abstract String[] buildUrlsForHandler(String beanName, Class<?> beanClass);
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -120,7 +120,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
* <p>Default is GET, HEAD and POST for simple form controller types;
|
||||
* unrestricted for general controllers and interceptors.
|
||||
*/
|
||||
public final void setSupportedMethods(String[] methods) {
|
||||
public final void setSupportedMethods(String... methods) {
|
||||
if (methods != null) {
|
||||
this.supportedMethods = new HashSet<String>(Arrays.asList(methods));
|
||||
}
|
||||
@@ -210,7 +210,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether 'must-revaliate' is added to every Cache-Control header.
|
||||
* Return whether 'must-revalidate' is added to every Cache-Control header.
|
||||
*/
|
||||
public boolean isAlwaysMustRevalidate() {
|
||||
return alwaysMustRevalidate;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class AbstractTemplateViewResolver extends UrlBasedViewResolver {
|
||||
|
||||
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return AbstractTemplateView.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to add path variables in the model or not.
|
||||
* Specify whether to add path variables to the model or not.
|
||||
* <p>Path variables are commonly bound to URI template variables through the {@code @PathVariable}
|
||||
* annotation. They're are effectively URI template variables with type conversion applied to
|
||||
* them to derive typed Object values. Such values are frequently needed in views for
|
||||
@@ -233,14 +233,14 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||
* <p>Path variables added to the model override static attributes (see {@link #setAttributes(Properties)})
|
||||
* but not attributes already present in the model.
|
||||
* <p>By default this flag is set to {@code true}. Concrete view types can override this.
|
||||
* @param exposePathVariables {@code true} to expose path variables, and {@code false} otherwise.
|
||||
* @param exposePathVariables {@code true} to expose path variables, and {@code false} otherwise
|
||||
*/
|
||||
public void setExposePathVariables(boolean exposePathVariables) {
|
||||
this.exposePathVariables = exposePathVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the flag indicating whether path variables should be added to the model or not.
|
||||
* Return whether to add path variables to the model or not.
|
||||
*/
|
||||
public boolean isExposePathVariables() {
|
||||
return this.exposePathVariables;
|
||||
@@ -273,12 +273,13 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> pathVars = (this.exposePathVariables ?
|
||||
(Map<String, Object>) request.getAttribute(View.PATH_VARIABLES) : null);
|
||||
(Map<String, Object>) request.getAttribute(View.PATH_VARIABLES) : null);
|
||||
|
||||
// Consolidate static and dynamic model attributes.
|
||||
int size = this.staticAttributes.size();
|
||||
size += (model != null) ? model.size() : 0;
|
||||
size += (pathVars != null) ? pathVars.size() : 0;
|
||||
size += (model != null ? model.size() : 0);
|
||||
size += (pathVars != null ? pathVars.size() : 0);
|
||||
|
||||
Map<String, Object> mergedModel = new LinkedHashMap<String, Object>(size);
|
||||
mergedModel.putAll(this.staticAttributes);
|
||||
if (pathVars != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -156,7 +156,7 @@ public class InternalResourceView extends AbstractUrlBasedView {
|
||||
* the {@link #setExposeContextBeansAsAttributes "exposeContextBeansAsAttributes"}
|
||||
* flag on but do not list specific bean names for this property.
|
||||
*/
|
||||
public void setExposedContextBeanNames(String[] exposedContextBeanNames) {
|
||||
public void setExposedContextBeanNames(String... exposedContextBeanNames) {
|
||||
this.exposedContextBeanNames = new HashSet<String>(Arrays.asList(exposedContextBeanNames));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -63,22 +63,22 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver {
|
||||
* is present.
|
||||
*/
|
||||
public InternalResourceViewResolver() {
|
||||
Class viewClass = requiredViewClass();
|
||||
Class<?> viewClass = requiredViewClass();
|
||||
if (viewClass.equals(InternalResourceView.class) && jstlPresent) {
|
||||
viewClass = JstlView.class;
|
||||
}
|
||||
setViewClass(viewClass);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This resolver requires {@link InternalResourceView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return InternalResourceView.class;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify whether to always include the view rather than forward to it.
|
||||
* <p>Default is "false". Switch this flag on to enforce the use of a
|
||||
@@ -86,7 +86,7 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver {
|
||||
* @see InternalResourceView#setAlwaysInclude
|
||||
*/
|
||||
public void setAlwaysInclude(boolean alwaysInclude) {
|
||||
this.alwaysInclude = Boolean.valueOf(alwaysInclude);
|
||||
this.alwaysInclude = alwaysInclude;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ public class InternalResourceViewResolver extends UrlBasedViewResolver {
|
||||
* attributes.
|
||||
* @see InternalResourceView#setExposedContextBeanNames
|
||||
*/
|
||||
public void setExposedContextBeanNames(String[] exposedContextBeanNames) {
|
||||
public void setExposedContextBeanNames(String... exposedContextBeanNames) {
|
||||
this.exposedContextBeanNames = exposedContextBeanNames;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -129,7 +129,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
||||
* @see #setBasename
|
||||
* @see java.util.ResourceBundle#getBundle(String)
|
||||
*/
|
||||
public void setBasenames(String[] basenames) {
|
||||
public void setBasenames(String... basenames) {
|
||||
this.basenames = basenames;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -100,14 +100,12 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
public static final String FORWARD_URL_PREFIX = "forward:";
|
||||
|
||||
|
||||
private Class viewClass;
|
||||
private Class<?> viewClass;
|
||||
|
||||
private String prefix = "";
|
||||
|
||||
private String suffix = "";
|
||||
|
||||
private String[] viewNames = null;
|
||||
|
||||
private String contentType;
|
||||
|
||||
private boolean redirectContextRelative = true;
|
||||
@@ -116,20 +114,23 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
|
||||
private String requestContextAttribute;
|
||||
|
||||
private int order = Integer.MAX_VALUE;
|
||||
|
||||
/** Map of static attributes, keyed by attribute name (String) */
|
||||
private final Map<String, Object> staticAttributes = new HashMap<String, Object>();
|
||||
|
||||
private Boolean exposePathVariables;
|
||||
|
||||
private String[] viewNames;
|
||||
|
||||
private int order = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
/**
|
||||
* Set the view class that should be used to create views.
|
||||
* @param viewClass class that is assignable to the required view class
|
||||
* (by default, AbstractUrlBasedView)
|
||||
* @see AbstractUrlBasedView
|
||||
*/
|
||||
public void setViewClass(Class viewClass) {
|
||||
public void setViewClass(Class<?> viewClass) {
|
||||
if (viewClass == null || !requiredViewClass().isAssignableFrom(viewClass)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Given view class [" + (viewClass != null ? viewClass.getName() : null) +
|
||||
@@ -141,7 +142,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
/**
|
||||
* Return the view class to be used to create views.
|
||||
*/
|
||||
protected Class getViewClass() {
|
||||
protected Class<?> getViewClass() {
|
||||
return this.viewClass;
|
||||
}
|
||||
|
||||
@@ -150,7 +151,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
* This implementation returns AbstractUrlBasedView.
|
||||
* @see AbstractUrlBasedView
|
||||
*/
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return AbstractUrlBasedView.class;
|
||||
}
|
||||
|
||||
@@ -303,6 +304,29 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
return this.staticAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether views resolved by this resolver should add path variables to the model or not.
|
||||
* <p>>The default setting is to let each View decide (see {@link AbstractView#setExposePathVariables}.
|
||||
* However, you can use this property to override that.
|
||||
* @param exposePathVariables
|
||||
* <ul>
|
||||
* <li>{@code true} - all Views resolved by this resolver will expose path variables
|
||||
* <li>{@code false} - no Views resolved by this resolver will expose path variables
|
||||
* <li>{@code null} - individual Views can decide for themselves (this is used by the default)
|
||||
* <ul>
|
||||
* @see AbstractView#setExposePathVariables
|
||||
*/
|
||||
public void setExposePathVariables(Boolean exposePathVariables) {
|
||||
this.exposePathVariables = exposePathVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether views resolved by this resolver should add path variables to the model or not.
|
||||
*/
|
||||
protected Boolean getExposePathVariables() {
|
||||
return this.exposePathVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the view names (or name patterns) that can be handled by this
|
||||
* {@link org.springframework.web.servlet.ViewResolver}. View names can contain
|
||||
@@ -310,7 +334,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
* view name 'myReport'.
|
||||
* @see #canHandle
|
||||
*/
|
||||
public void setViewNames(String[] viewNames) {
|
||||
public void setViewNames(String... viewNames) {
|
||||
this.viewNames = viewNames;
|
||||
}
|
||||
|
||||
@@ -338,22 +362,6 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
return this.order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether views resolved by this resolver should add path variables the model or not.
|
||||
* The default setting is to allow each View decide (see {@link AbstractView#setExposePathVariables(boolean)}.
|
||||
* However, you can use this property to override that.
|
||||
* @param exposePathVariables
|
||||
* <ul>
|
||||
* <li>{@code true} - all Views resolved by this resolver will expose path variables
|
||||
* <li>{@code false} - no Views resolved by this resolver will expose path variables
|
||||
* <li>{@code null} - individual Views can decide for themselves (this is used by the default)
|
||||
* <ul>
|
||||
* @see AbstractView#setExposePathVariables(boolean)
|
||||
*/
|
||||
public void setExposePathVariables(Boolean exposePathVariables) {
|
||||
this.exposePathVariables = exposePathVariables;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initApplicationContext() {
|
||||
super.initApplicationContext();
|
||||
@@ -362,6 +370,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This implementation returns just the view name,
|
||||
* as this ViewResolver doesn't support localized resolution.
|
||||
@@ -459,15 +468,20 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
protected AbstractUrlBasedView buildView(String viewName) throws Exception {
|
||||
AbstractUrlBasedView view = (AbstractUrlBasedView) BeanUtils.instantiateClass(getViewClass());
|
||||
view.setUrl(getPrefix() + viewName + getSuffix());
|
||||
|
||||
String contentType = getContentType();
|
||||
if (contentType != null) {
|
||||
view.setContentType(contentType);
|
||||
}
|
||||
|
||||
view.setRequestContextAttribute(getRequestContextAttribute());
|
||||
view.setAttributesMap(getAttributesMap());
|
||||
if (this.exposePathVariables != null) {
|
||||
|
||||
Boolean exposePathVariables = getExposePathVariables();
|
||||
if (exposePathVariables != null) {
|
||||
view.setExposePathVariables(exposePathVariables);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FreeMarkerViewResolver extends AbstractTemplateViewResolver {
|
||||
* Requires {@link FreeMarkerView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return FreeMarkerView.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -215,7 +215,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
* <p>The name specified in the list should correspond to an attribute in the
|
||||
* model Map, and to a sub-report data source parameter in your report file.
|
||||
* If you pass in {@code JRDataSource} objects as model attributes,
|
||||
* specifing this list of keys is not required.
|
||||
* specifying this list of keys is not required.
|
||||
* <p>If you specify a list of sub-report data keys, it is required to also
|
||||
* specify a {@code reportDataKey} for the main report, to avoid confusion
|
||||
* between the data source objects for the various reports involved.
|
||||
@@ -226,7 +226,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
* @see net.sf.jasperreports.engine.data.JRBeanCollectionDataSource
|
||||
* @see net.sf.jasperreports.engine.data.JRBeanArrayDataSource
|
||||
*/
|
||||
public void setSubReportDataKeys(String[] subReportDataKeys) {
|
||||
public void setSubReportDataKeys(String... subReportDataKeys) {
|
||||
this.subReportDataKeys = subReportDataKeys;
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
String fieldName = fqFieldName.substring(index + 1);
|
||||
|
||||
try {
|
||||
Class cls = ClassUtils.forName(className, getApplicationContext().getClassLoader());
|
||||
Class<?> cls = ClassUtils.forName(className, getApplicationContext().getClassLoader());
|
||||
Field field = cls.getField(fieldName);
|
||||
|
||||
if (JRExporterParameter.class.isAssignableFrom(field.getType())) {
|
||||
@@ -534,7 +534,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
* {@link #renderReport} method that should be implemented by the subclass.
|
||||
* @param model the model map, as passed in for view rendering. Must contain
|
||||
* a report data value that can be converted to a {@code JRDataSource},
|
||||
* acccording to the rules of the {@link #fillReport} method.
|
||||
* according to the rules of the {@link #fillReport} method.
|
||||
*/
|
||||
@Override
|
||||
protected void renderMergedOutputModel(
|
||||
@@ -637,7 +637,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
}
|
||||
}
|
||||
else {
|
||||
Collection values = model.values();
|
||||
Collection<?> values = model.values();
|
||||
jrDataSource = CollectionUtils.findValueOfType(values, JRDataSource.class);
|
||||
if (jrDataSource == null) {
|
||||
JRDataSourceProvider provider = CollectionUtils.findValueOfType(values, JRDataSourceProvider.class);
|
||||
@@ -705,7 +705,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
*/
|
||||
private void populateHeaders(HttpServletResponse response) {
|
||||
// Apply the headers to the response.
|
||||
for (Enumeration en = this.headers.propertyNames(); en.hasMoreElements();) {
|
||||
for (Enumeration<?> en = this.headers.propertyNames(); en.hasMoreElements();) {
|
||||
String key = (String) en.nextElement();
|
||||
response.addHeader(key, this.headers.getProperty(key));
|
||||
}
|
||||
@@ -795,8 +795,8 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
* <p>Default value types are: {@code java.util.Collection} and {@code Object} array.
|
||||
* @return the value types in prioritized order
|
||||
*/
|
||||
protected Class[] getReportDataTypes() {
|
||||
return new Class[] {Collection.class, Object[].class};
|
||||
protected Class<?>[] getReportDataTypes() {
|
||||
return new Class<?>[] {Collection.class, Object[].class};
|
||||
}
|
||||
|
||||
|
||||
@@ -813,12 +813,12 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
|
||||
/**
|
||||
* Subclasses should implement this method to perform the actual rendering process.
|
||||
* <p>Note that the content type has not been set yet: Implementors should build
|
||||
* <p>Note that the content type has not been set yet: Implementers should build
|
||||
* a content type String and set it via {@code response.setContentType}.
|
||||
* If necessary, this can include a charset clause for a specific encoding.
|
||||
* The latter will only be necessary for textual output onto a Writer, and only
|
||||
* in case of the encoding being specified in the JasperReports exporter parameters.
|
||||
* <p><b>WARNING:</b> Implementors should not use {@code response.setCharacterEncoding}
|
||||
* <p><b>WARNING:</b> Implementers should not use {@code response.setCharacterEncoding}
|
||||
* unless they are willing to depend on Servlet API 2.4 or higher. Prefer a
|
||||
* concatenated content type String with a charset clause instead.
|
||||
* @param populatedReport the populated {@code JasperPrint} to render
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -51,7 +51,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver {
|
||||
* Requires the view class to be a subclass of {@link AbstractJasperReportsView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return AbstractJasperReportsView.class;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver {
|
||||
* Set the {@code subReportDataKeys} the view class should use.
|
||||
* @see AbstractJasperReportsView#setSubReportDataKeys
|
||||
*/
|
||||
public void setSubReportDataKeys(String[] subReportDataKeys) {
|
||||
public void setSubReportDataKeys(String... subReportDataKeys) {
|
||||
this.subReportDataKeys = subReportDataKeys;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TilesViewResolver extends UrlBasedViewResolver {
|
||||
* Requires {@link TilesView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return TilesView.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class VelocityLayoutViewResolver extends VelocityViewResolver {
|
||||
* @see VelocityLayoutView
|
||||
*/
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return VelocityLayoutView.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class VelocityViewResolver extends AbstractTemplateViewResolver {
|
||||
* Requires {@link VelocityView}.
|
||||
*/
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
protected Class<?> requiredViewClass() {
|
||||
return VelocityView.class;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class VelocityViewResolver extends AbstractTemplateViewResolver {
|
||||
* to automatically load a Velocity Tools toolbox definition file and expose
|
||||
* all defined tools in the specified scopes. If no config location is
|
||||
* specified, no toolbox will be loaded and exposed.
|
||||
* <p>The specfied location string needs to refer to a ServletContext
|
||||
* <p>The specified location string needs to refer to a ServletContext
|
||||
* resource, as expected by ServletToolboxManager which is part of
|
||||
* the view package of Velocity Tools.
|
||||
* <p><b>Note:</b> Specifying a toolbox config location will lead to
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 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.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.web.servlet.view.xslt;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.URIResolver;
|
||||
|
||||
@@ -49,10 +48,15 @@ public class XsltViewResolver extends UrlBasedViewResolver {
|
||||
|
||||
|
||||
public XsltViewResolver() {
|
||||
setViewClass(XsltView.class);
|
||||
setViewClass(requiredViewClass());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Class<?> requiredViewClass() {
|
||||
return XsltView.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the model attribute that represents the XSLT Source.
|
||||
* If not specified, the model map will be searched for a matching value type.
|
||||
@@ -117,11 +121,6 @@ public class XsltViewResolver extends UrlBasedViewResolver {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Class requiredViewClass() {
|
||||
return XsltView.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractUrlBasedView buildView(String viewName) throws Exception {
|
||||
XsltView view = (XsltView) super.buildView(viewName);
|
||||
|
||||
Reference in New Issue
Block a user