Remove trailing whitespace in source files
find . -type f -name "*.java" -or -name "*.aj" | \
xargs perl -p -i -e "s/[ \t]*$//g" {} \;
Issue: SPR-10127
This commit is contained in:
committed by
Chris Beams
parent
44a474a014
commit
1762157ad1
@@ -63,7 +63,7 @@ class InterceptingClientHttpRequest extends AbstractBufferingClientHttpRequest {
|
||||
@Override
|
||||
protected final ClientHttpResponse executeInternal(HttpHeaders headers, byte[] bufferedOutput) throws IOException {
|
||||
RequestExecution requestExecution = new RequestExecution();
|
||||
|
||||
|
||||
return requestExecution.execute(this, bufferedOutput);
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ public class HessianClientInterceptor extends UrlBasedRemoteAccessor implements
|
||||
}
|
||||
catch (InvocationTargetException ex) {
|
||||
Throwable targetEx = ex.getTargetException();
|
||||
// Hessian 4.0 check: another layer of InvocationTargetException.
|
||||
// Hessian 4.0 check: another layer of InvocationTargetException.
|
||||
if (targetEx instanceof InvocationTargetException) {
|
||||
targetEx = ((InvocationTargetException) targetEx).getTargetException();
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* This package provides remoting classes for Caucho's Hessian and Burlap
|
||||
* protocols: a proxy factory for accessing Hessian/Burlap services,
|
||||
* and an exporter for making beans available to Hessian/Burlap clients.
|
||||
*
|
||||
*
|
||||
* <p>Hessian is a slim, binary RPC protocol over HTTP.
|
||||
* For information on Hessian, see the
|
||||
* <a href="http://www.caucho.com/hessian">Hessian website</a>
|
||||
*
|
||||
*
|
||||
* <p>Burlap is a slim, XML-based RPC protocol over HTTP.
|
||||
* For information on Burlap, see the
|
||||
* <a href="http://www.caucho.com/burlap">Burlap website</a>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Remoting classes for transparent Java-to-Java remoting via HTTP invokers.
|
||||
* Uses Java serialization just like RMI, but provides the same ease of setup
|
||||
* as Caucho's HTTP-based Hessian and Burlap protocols.
|
||||
*
|
||||
*
|
||||
* <p><b>HTTP invoker is the recommended protocol for Java-to-Java remoting.</b>
|
||||
* It is more powerful and more extensible than Hessian and Burlap, at the
|
||||
* expense of being tied to Java. Neverthelesss, it is as easy to set up as
|
||||
|
||||
@@ -62,7 +62,7 @@ import org.springframework.web.util.WebUtils;
|
||||
public abstract class ServletEndpointSupport implements ServiceLifecycle {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
|
||||
private ServletEndpointContext servletEndpointContext;
|
||||
|
||||
private WebApplicationContext webApplicationContext;
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.validation.ObjectError;
|
||||
public class MethodArgumentNotValidException extends Exception {
|
||||
|
||||
private final MethodParameter parameter;
|
||||
|
||||
|
||||
private final BindingResult bindingResult;
|
||||
|
||||
|
||||
@@ -69,5 +69,5 @@ public class MethodArgumentNotValidException extends Exception {
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ServletRequestDataBinder extends WebDataBinder {
|
||||
/**
|
||||
* Extension point that subclasses can use to add extra bind values for a
|
||||
* request. Invoked before {@link #doBind(MutablePropertyValues)}.
|
||||
* The default implementation is empty.
|
||||
* The default implementation is empty.
|
||||
* @param mpvs the property values that will be used for data binding
|
||||
* @param request the current request
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* HTML checkboxes and select options: detecting that a field was part of
|
||||
* the form, but did not generate a request parameter because it was empty.
|
||||
* A field marker allows to detect that state and reset the corresponding
|
||||
* bean property accordingly. Default values, for parameters that are otherwise
|
||||
* bean property accordingly. Default values, for parameters that are otherwise
|
||||
* not present, can specify a value for the field other then empty.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
@@ -65,7 +65,7 @@ public class WebDataBinder extends DataBinder {
|
||||
/**
|
||||
* Default prefix that field default parameters start with, followed by the field
|
||||
* name: e.g. "!subscribeToNewsletter" for a field "subscribeToNewsletter".
|
||||
* <p>Default parameters differ from field markers in that they provide a default
|
||||
* <p>Default parameters differ from field markers in that they provide a default
|
||||
* value instead of an empty value.
|
||||
* @see #setFieldDefaultPrefix
|
||||
*/
|
||||
@@ -134,15 +134,15 @@ public class WebDataBinder extends DataBinder {
|
||||
|
||||
/**
|
||||
* Specify a prefix that can be used for parameters that indicate default
|
||||
* value fields, having "prefix + field" as name. The value of the default
|
||||
* value fields, having "prefix + field" as name. The value of the default
|
||||
* field is used when the field is not provided.
|
||||
* <p>Default is "!", for "!FIELD" parameters (e.g. "!subscribeToNewsletter").
|
||||
* Set this to null if you want to turn off the field defaults completely.
|
||||
* <p>HTML checkboxes only send a value when they're checked, so it is not
|
||||
* possible to detect that a formerly checked box has just been unchecked,
|
||||
* at least not with standard HTML means. A default field is especially
|
||||
* at least not with standard HTML means. A default field is especially
|
||||
* useful when a checkbox represents a non-boolean value.
|
||||
* <p>The presence of a default parameter preempts the behavior of a field
|
||||
* <p>The presence of a default parameter preempts the behavior of a field
|
||||
* marker for the given field.
|
||||
* @see #DEFAULT_FIELD_DEFAULT_PREFIX
|
||||
* @see org.springframework.web.servlet.mvc.BaseCommandController#onBind
|
||||
@@ -208,7 +208,7 @@ public class WebDataBinder extends DataBinder {
|
||||
String field = pv.getName().substring(fieldDefaultPrefix.length());
|
||||
if (getPropertyAccessor().isWritableProperty(field) && !mpvs.contains(field)) {
|
||||
mpvs.add(field, pv.getValue());
|
||||
}
|
||||
}
|
||||
mpvs.removePropertyValue(pv);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,29 +29,29 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartResolver;
|
||||
|
||||
/**
|
||||
* Annotation that can be used to associate the part of a "multipart/form-data" request
|
||||
* Annotation that can be used to associate the part of a "multipart/form-data" request
|
||||
* with a method argument. Supported method argument types include {@link MultipartFile}
|
||||
* in conjunction with Spring's {@link MultipartResolver} abstraction,
|
||||
* in conjunction with Spring's {@link MultipartResolver} abstraction,
|
||||
* {@code javax.servlet.http.Part} in conjunction with Servlet 3.0 multipart requests,
|
||||
* or otherwise for any other method argument, the content of the part is passed through an
|
||||
* {@link HttpMessageConverter} taking into consideration the 'Content-Type' header
|
||||
* of the request part. This is analogous to what @{@link RequestBody} does to resolve
|
||||
* or otherwise for any other method argument, the content of the part is passed through an
|
||||
* {@link HttpMessageConverter} taking into consideration the 'Content-Type' header
|
||||
* of the request part. This is analogous to what @{@link RequestBody} does to resolve
|
||||
* an argument based on the content of a non-multipart regular request.
|
||||
*
|
||||
* <p>Note that @{@link RequestParam} annotation can also be used to associate the
|
||||
*
|
||||
* <p>Note that @{@link RequestParam} annotation can also be used to associate the
|
||||
* part of a "multipart/form-data" request with a method argument supporting the same
|
||||
* method argument types. The main difference is that when the method argument is not a
|
||||
* String, @{@link RequestParam} relies on type conversion via a registered
|
||||
* String, @{@link RequestParam} relies on type conversion via a registered
|
||||
* {@link Converter} or {@link PropertyEditor} while @{@link RequestPart} relies
|
||||
* on {@link HttpMessageConverter}s taking into consideration the 'Content-Type' header
|
||||
* of the request part. @{@link RequestParam} is likely to be used with name-value form
|
||||
* of the request part. @{@link RequestParam} is likely to be used with name-value form
|
||||
* fields while @{@link RequestPart} is likely to be used with parts containing more
|
||||
* complex content (e.g. JSON, XML).
|
||||
*
|
||||
* complex content (e.g. JSON, XML).
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.1
|
||||
*
|
||||
*
|
||||
* @see RequestParam
|
||||
* @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public @interface RequestPart {
|
||||
* The name of the part in the "multipart/form-data" request to bind to.
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
|
||||
/**
|
||||
* Whether the part is required.
|
||||
* <p>Default is <code>true</code>, leading to an exception thrown in case
|
||||
@@ -72,5 +72,5 @@ public @interface RequestPart {
|
||||
* if you prefer a <code>null</value> in case of the part missing.
|
||||
*/
|
||||
boolean required() default true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ public class HandlerMethodInvoker {
|
||||
}
|
||||
throw new IllegalArgumentException(
|
||||
"HttpEntity parameter (" + methodParam.getParameterName() + ") is not parameterized");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Object resolveCookieValue(String cookieName, boolean required, String defaultValue,
|
||||
|
||||
@@ -20,9 +20,9 @@ import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
/**
|
||||
* Create a {@link WebRequestDataBinder} instance and initialize it with a
|
||||
* Create a {@link WebRequestDataBinder} instance and initialize it with a
|
||||
* {@link WebBindingInitializer}.
|
||||
*
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
@@ -39,8 +39,8 @@ public class DefaultDataBinderFactory implements WebDataBinderFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link WebDataBinder} for the given target object and
|
||||
* initialize it through a {@link WebBindingInitializer}.
|
||||
* Create a new {@link WebDataBinder} for the given target object and
|
||||
* initialize it through a {@link WebBindingInitializer}.
|
||||
* @throws Exception in case of invalid state or arguments
|
||||
*/
|
||||
public final WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName)
|
||||
@@ -57,7 +57,7 @@ public class DefaultDataBinderFactory implements WebDataBinderFactory {
|
||||
* Extension point to create the WebDataBinder instance.
|
||||
* By default this is {@code WebRequestDataBinder}.
|
||||
* @param target the binding target or {@code null} for type conversion only
|
||||
* @param objectName the binding target object name
|
||||
* @param objectName the binding target object name
|
||||
* @param webRequest the current request
|
||||
* @throws Exception in case of invalid state or arguments
|
||||
*/
|
||||
@@ -67,8 +67,8 @@ public class DefaultDataBinderFactory implements WebDataBinderFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension point to further initialize the created data binder instance
|
||||
* (e.g. with {@code @InitBinder} methods) after "global" initializaton
|
||||
* Extension point to further initialize the created data binder instance
|
||||
* (e.g. with {@code @InitBinder} methods) after "global" initializaton
|
||||
* via {@link WebBindingInitializer}.
|
||||
* @param dataBinder the data binder instance to customize
|
||||
* @param webRequest the current request
|
||||
|
||||
@@ -20,21 +20,21 @@ import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
/**
|
||||
* A factory for creating a {@link WebDataBinder} instance for a named target object.
|
||||
*
|
||||
* A factory for creating a {@link WebDataBinder} instance for a named target object.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.1
|
||||
*/
|
||||
public interface WebDataBinderFactory {
|
||||
|
||||
/**
|
||||
* Create a {@link WebDataBinder} for the given object.
|
||||
* Create a {@link WebDataBinder} for the given object.
|
||||
* @param webRequest the current request
|
||||
* @param target the object to create a data binder for, or {@code null} if creating a binder for a simple type
|
||||
* @param objectName the name of the target object
|
||||
* @param objectName the name of the target object
|
||||
* @return the created {@link WebDataBinder} instance, never null
|
||||
* @throws Exception raised if the creation and initialization of the data binder fails
|
||||
* @throws Exception raised if the creation and initialization of the data binder fails
|
||||
*/
|
||||
WebDataBinder createBinder(NativeWebRequest webRequest, Object target, String objectName) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Interface to provide configuration for a web application. This is read-only while
|
||||
* the application is running, but may be reloaded if the implementation supports this.
|
||||
*
|
||||
@@ -107,5 +107,5 @@ public interface WebApplicationContext extends ApplicationContext {
|
||||
* <p>Also available for a Portlet application, in addition to the PortletContext.
|
||||
*/
|
||||
ServletContext getServletContext();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.beans.factory.config.Scope;
|
||||
*
|
||||
* <p>Subclasses may wish to override the {@link #get} and {@link #remove}
|
||||
* methods to add synchronization around the call back into this super class.
|
||||
*
|
||||
*
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -93,7 +93,7 @@ public class FacesWebRequest extends FacesRequestAttributes implements NativeWeb
|
||||
public Iterator<String> getParameterNames() {
|
||||
return getExternalContext().getRequestParameterNames();
|
||||
}
|
||||
|
||||
|
||||
public String[] getParameterValues(String paramName) {
|
||||
return getExternalContext().getRequestParameterValuesMap().get(paramName);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @see org.springframework.web.portlet.DispatcherPortlet
|
||||
*/
|
||||
public abstract class RequestContextHolder {
|
||||
|
||||
|
||||
private static final boolean jsfPresent =
|
||||
ClassUtils.isPresent("javax.faces.context.FacesContext", RequestContextHolder.class.getClassLoader());
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ServletWebRequest extends ServletRequestAttributes implements Nativ
|
||||
private static final String HEADER_LAST_MODIFIED = "Last-Modified";
|
||||
|
||||
private static final String METHOD_GET = "GET";
|
||||
|
||||
|
||||
|
||||
private HttpServletResponse response;
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public interface WebRequest extends RequestAttributes {
|
||||
* @since 3.0
|
||||
*/
|
||||
Iterator<String> getParameterNames();
|
||||
|
||||
|
||||
/**
|
||||
* Return a immutable Map of the request parameters, with parameter names as map keys
|
||||
* and parameter values as map values. The map values will be of type String array.
|
||||
@@ -174,7 +174,7 @@ public interface WebRequest extends RequestAttributes {
|
||||
* {@link #checkNotModified(long)}, but not both.
|
||||
* @param eTag the entity tag that the application determined
|
||||
* for the underlying resource. This parameter will be padded
|
||||
* with quotes (") if necessary.
|
||||
* with quotes (") if necessary.
|
||||
* @return whether the request qualifies as not modified,
|
||||
* allowing to abort request processing and relying on the response
|
||||
* telling the client that the content has not been modified
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* {@link PropertySource} that reads init parameters from a {@link ServletContext} object.
|
||||
*
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @since 3.1
|
||||
* @see ServletConfigPropertySource
|
||||
|
||||
@@ -33,11 +33,11 @@ import javax.servlet.ServletResponse;
|
||||
* This is useful for filters that require dependency injection, and can therefore be set up in a Spring application
|
||||
* context. Typically this composite would be used in conjunction with {@link DelegatingFilterProxy}, so that it can be
|
||||
* declared in Spring but applied to a servlet context.
|
||||
*
|
||||
*
|
||||
* @since 3.1
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class CompositeFilter implements Filter {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CompositeFilter implements Filter {
|
||||
|
||||
/**
|
||||
* Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.
|
||||
*
|
||||
*
|
||||
* @see Filter#init(FilterConfig)
|
||||
*/
|
||||
public void destroy() {
|
||||
@@ -61,7 +61,7 @@ public class CompositeFilter implements Filter {
|
||||
|
||||
/**
|
||||
* Initialize all the filters, calling each one's init method in turn in the order supplied.
|
||||
*
|
||||
*
|
||||
* @see Filter#init(FilterConfig)
|
||||
*/
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
@@ -74,7 +74,7 @@ public class CompositeFilter implements Filter {
|
||||
* Forms a temporary chain from the list of delegate filters supplied ({@link #setFilters(List)}) and executes them
|
||||
* in order. Each filter delegates to the next one in the list, achieving the normal behaviour of a
|
||||
* {@link FilterChain}, despite the fact that this is a {@link Filter}.
|
||||
*
|
||||
*
|
||||
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
|
||||
*/
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Support classes for integrating a JSF 1.2 web tier with a Spring middle tier
|
||||
* which is hosted in a Spring root WebApplicationContext.
|
||||
*
|
||||
*
|
||||
* <p>Supports JSF 1.2's ELResolver mechanism, providing closer integration
|
||||
* than JSF 1.1's VariableResolver mechanism allowed for.
|
||||
*
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Support classes for integrating a JSF web tier with a Spring middle tier
|
||||
* which is hosted in a Spring root WebApplicationContext.
|
||||
*
|
||||
*
|
||||
* <p>Supports easy access to beans in the Spring root WebApplicationContext
|
||||
* from JSF EL expressions, for example in property values of JSF-managed beans.
|
||||
*
|
||||
|
||||
@@ -28,18 +28,18 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.ReflectionUtils.MethodFilter;
|
||||
|
||||
/**
|
||||
* Defines the algorithm for searching handler methods exhaustively including interfaces and parent
|
||||
* Defines the algorithm for searching handler methods exhaustively including interfaces and parent
|
||||
* classes while also dealing with parameterized methods as well as interface and class-based proxies.
|
||||
*
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
public abstract class HandlerMethodSelector {
|
||||
|
||||
|
||||
/**
|
||||
* Selects handler methods for the given handler type. Callers of this method define handler methods
|
||||
* of interest through the {@link MethodFilter} parameter.
|
||||
*
|
||||
*
|
||||
* @param handlerType the handler type to search handler methods on
|
||||
* @param handlerMethodFilter a {@link MethodFilter} to help recognize handler methods of interest
|
||||
* @return the selected methods, or an empty set
|
||||
|
||||
@@ -23,16 +23,16 @@ import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.CookieValue;
|
||||
|
||||
/**
|
||||
* A base abstract class to resolve method arguments annotated with
|
||||
* A base abstract class to resolve method arguments annotated with
|
||||
* {@code @CookieValue}. Subclasses extract the cookie value from the request.
|
||||
*
|
||||
* <p>An {@code @CookieValue} is a named value that is resolved from a cookie.
|
||||
* It has a required flag and a default value to fall back on when the cookie
|
||||
* does not exist.
|
||||
*
|
||||
* <p>A {@link WebDataBinder} may be invoked to apply type conversion to the
|
||||
*
|
||||
* <p>An {@code @CookieValue} is a named value that is resolved from a cookie.
|
||||
* It has a required flag and a default value to fall back on when the cookie
|
||||
* does not exist.
|
||||
*
|
||||
* <p>A {@link WebDataBinder} may be invoked to apply type conversion to the
|
||||
* resolved cookie value.
|
||||
*
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
@@ -40,7 +40,7 @@ import org.springframework.web.bind.annotation.CookieValue;
|
||||
public abstract class AbstractCookieValueMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver {
|
||||
|
||||
/**
|
||||
* @param beanFactory a bean factory to use for resolving ${...}
|
||||
* @param beanFactory a bean factory to use for resolving ${...}
|
||||
* placeholder and #{...} SpEL expressions in default values;
|
||||
* or {@code null} if default values are not expected to contain expressions
|
||||
*/
|
||||
|
||||
@@ -26,21 +26,21 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
/**
|
||||
* Resolves method arguments annotated with {@code @Value}.
|
||||
*
|
||||
*
|
||||
* <p>An {@code @Value} does not have a name but gets resolved from the default
|
||||
* value string, which may contain ${...} placeholder or Spring Expression
|
||||
* Language #{...} expressions.
|
||||
*
|
||||
* <p>A {@link WebDataBinder} may be invoked to apply type conversion to
|
||||
* value string, which may contain ${...} placeholder or Spring Expression
|
||||
* Language #{...} expressions.
|
||||
*
|
||||
* <p>A {@link WebDataBinder} may be invoked to apply type conversion to
|
||||
* resolved argument value.
|
||||
*
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
public class ExpressionValueMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver {
|
||||
|
||||
/**
|
||||
* @param beanFactory a bean factory to use for resolving ${...}
|
||||
* @param beanFactory a bean factory to use for resolving ${...}
|
||||
* placeholder and #{...} SpEL expressions in default values;
|
||||
* or {@code null} if default values are not expected to contain expressions
|
||||
*/
|
||||
@@ -75,5 +75,5 @@ public class ExpressionValueMethodArgumentResolver extends AbstractNamedValueMet
|
||||
private ExpressionValueNamedValueInfo(Value annotation) {
|
||||
super("@Value", false, annotation.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ import org.springframework.web.method.support.InvocableHandlerMethod;
|
||||
public class InitBinderDataBinderFactory extends DefaultDataBinderFactory {
|
||||
|
||||
private final List<InvocableHandlerMethod> binderMethods;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
* @param binderMethods {@code @InitBinder} methods, or {@code null}
|
||||
@@ -68,8 +68,8 @@ public class InitBinderDataBinderFactory extends DefaultDataBinderFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if the given {@code @InitBinder} method should be
|
||||
* invoked to initialize the given WebDataBinder.
|
||||
* Return {@code true} if the given {@code @InitBinder} method should be
|
||||
* invoked to initialize the given WebDataBinder.
|
||||
* <p>The default implementation checks if target object name is included
|
||||
* in the attribute names specified in the {@code @InitBinder} annotation.
|
||||
*/
|
||||
@@ -78,5 +78,5 @@ public class InitBinderDataBinderFactory extends DefaultDataBinderFactory {
|
||||
Collection<String> names = Arrays.asList(annot.value());
|
||||
return (names.size() == 0 || names.contains(binder.getObjectName()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -41,24 +41,24 @@ import org.springframework.web.method.support.InvocableHandlerMethod;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
/**
|
||||
* Provides methods to initialize the {@link Model} before controller method
|
||||
* invocation and to update it afterwards. On initialization, the model is
|
||||
* populated with attributes from the session or by invoking
|
||||
* {@code @ModelAttribute} methods. On update, model attributes are
|
||||
* synchronized with the session -- either adding or removing them.
|
||||
* Provides methods to initialize the {@link Model} before controller method
|
||||
* invocation and to update it afterwards. On initialization, the model is
|
||||
* populated with attributes from the session or by invoking
|
||||
* {@code @ModelAttribute} methods. On update, model attributes are
|
||||
* synchronized with the session -- either adding or removing them.
|
||||
* Also {@link BindingResult} attributes where missing.
|
||||
*
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
public final class ModelFactory {
|
||||
|
||||
private final List<InvocableHandlerMethod> attributeMethods;
|
||||
|
||||
|
||||
private final WebDataBinderFactory binderFactory;
|
||||
|
||||
|
||||
private final SessionAttributesHandler sessionAttributesHandler;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance with the given {@code @ModelAttribute} methods.
|
||||
* @param attributeMethods for model initialization
|
||||
@@ -76,15 +76,15 @@ public final class ModelFactory {
|
||||
/**
|
||||
* Populate the model in the following order:
|
||||
* <ol>
|
||||
* <li>Retrieve "known" session attributes -- i.e. attributes listed via
|
||||
* {@link SessionAttributes @SessionAttributes} and previously stored in
|
||||
* <li>Retrieve "known" session attributes -- i.e. attributes listed via
|
||||
* {@link SessionAttributes @SessionAttributes} and previously stored in
|
||||
* the in the model at least once
|
||||
* <li>Invoke {@link ModelAttribute @ModelAttribute} methods
|
||||
* <li>Find method arguments eligible as session attributes and retrieve
|
||||
* them if they're not already present in the model
|
||||
* them if they're not already present in the model
|
||||
* </ol>
|
||||
* @param request the current request
|
||||
* @param mavContainer contains the model to be initialized
|
||||
* @param mavContainer contains the model to be initialized
|
||||
* @param handlerMethod the method for which the model is initialized
|
||||
* @throws Exception may arise from {@code @ModelAttribute} methods
|
||||
*/
|
||||
@@ -108,18 +108,18 @@ public final class ModelFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke model attribute methods to populate the model. Attributes are
|
||||
* 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 mavContainer)
|
||||
throws Exception {
|
||||
|
||||
|
||||
for (InvocableHandlerMethod attrMethod : this.attributeMethods) {
|
||||
String modelName = attrMethod.getMethodAnnotation(ModelAttribute.class).value();
|
||||
if (mavContainer.containsAttribute(modelName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Object returnValue = attrMethod.invokeForRequest(request, mavContainer);
|
||||
|
||||
if (!attrMethod.isVoid()){
|
||||
@@ -130,9 +130,9 @@ public final class ModelFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all {@code @ModelAttribute} arguments declared as session
|
||||
* Return all {@code @ModelAttribute} arguments declared as session
|
||||
* attributes via {@code @SessionAttributes}.
|
||||
*/
|
||||
private List<String> findSessionAttributeArguments(HandlerMethod handlerMethod) {
|
||||
@@ -147,12 +147,12 @@ public final class ModelFactory {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Derive the model attribute name for the given return value using
|
||||
* Derive the model attribute name for the given return value using
|
||||
* one of the following:
|
||||
* <ol>
|
||||
* <li>The method {@code ModelAttribute} annotation value
|
||||
* <li>The method {@code ModelAttribute} annotation value
|
||||
* <li>The declared return type if it is other than {@code Object}
|
||||
* <li>The actual return value type
|
||||
* </ol>
|
||||
@@ -176,7 +176,7 @@ public final class ModelFactory {
|
||||
* Derives the model attribute name for a method parameter based on:
|
||||
* <ol>
|
||||
* <li>The parameter {@code @ModelAttribute} annotation value
|
||||
* <li>The parameter type
|
||||
* <li>The parameter type
|
||||
* </ol>
|
||||
* @return the derived name; never {@code null} or an empty string
|
||||
*/
|
||||
@@ -185,7 +185,7 @@ public final class ModelFactory {
|
||||
String attrName = (annot != null) ? annot.value() : null;
|
||||
return StringUtils.hasText(attrName) ? attrName : Conventions.getVariableNameForParameter(parameter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Synchronize model attributes with the session. Add {@link BindingResult}
|
||||
* attributes where necessary.
|
||||
@@ -194,17 +194,17 @@ public final class ModelFactory {
|
||||
* @throws Exception if creating BindingResult attributes fails
|
||||
*/
|
||||
public void updateModel(NativeWebRequest request, ModelAndViewContainer mavContainer) throws Exception {
|
||||
|
||||
|
||||
if (mavContainer.getSessionStatus().isComplete()){
|
||||
this.sessionAttributesHandler.cleanupAttributes(request);
|
||||
}
|
||||
else {
|
||||
this.sessionAttributesHandler.storeAttributes(request, mavContainer.getModel());
|
||||
}
|
||||
|
||||
|
||||
if (!mavContainer.isRequestHandled()) {
|
||||
updateBindingResult(request, mavContainer.getModel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,7 +217,7 @@ public final class ModelFactory {
|
||||
|
||||
if (isBindingCandidate(name, value)) {
|
||||
String bindingResultKey = BindingResult.MODEL_KEY_PREFIX + name;
|
||||
|
||||
|
||||
if (!model.containsAttribute(bindingResultKey)) {
|
||||
WebDataBinder dataBinder = binderFactory.createBinder(request, value, name);
|
||||
model.put(bindingResultKey, dataBinder.getBindingResult());
|
||||
@@ -233,14 +233,14 @@ public final class ModelFactory {
|
||||
if (attributeName.startsWith(BindingResult.MODEL_KEY_PREFIX)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Class<?> attrType = (value != null) ? value.getClass() : null;
|
||||
if (this.sessionAttributesHandler.isHandlerSessionAttribute(attributeName, attrType)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (value != null && !value.getClass().isArray() && !(value instanceof Collection) &&
|
||||
|
||||
return (value != null && !value.getClass().isArray() && !(value instanceof Collection) &&
|
||||
!(value instanceof Map) && !BeanUtils.isSimpleValueType(value.getClass()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -27,16 +27,16 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
/**
|
||||
* Resolves method arguments annotated with {@code @RequestHeader} except for
|
||||
* {@link Map} arguments. See {@link RequestHeaderMapMethodArgumentResolver} for
|
||||
* {@link Map} arguments. See {@link RequestHeaderMapMethodArgumentResolver} for
|
||||
* details on {@link Map} arguments annotated with {@code @RequestHeader}.
|
||||
*
|
||||
* <p>An {@code @RequestHeader} is a named value resolved from a request header.
|
||||
* It has a required flag and a default value to fall back on when the request
|
||||
* header does not exist.
|
||||
*
|
||||
* <p>A {@link WebDataBinder} is invoked to apply type conversion to resolved
|
||||
* <p>An {@code @RequestHeader} is a named value resolved from a request header.
|
||||
* It has a required flag and a default value to fall back on when the request
|
||||
* header does not exist.
|
||||
*
|
||||
* <p>A {@link WebDataBinder} is invoked to apply type conversion to resolved
|
||||
* request header values that don't yet match the method parameter type.
|
||||
*
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
@@ -44,7 +44,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
public class RequestHeaderMethodArgumentResolver extends AbstractNamedValueMethodArgumentResolver {
|
||||
|
||||
/**
|
||||
* @param beanFactory a bean factory to use for resolving ${...}
|
||||
* @param beanFactory a bean factory to use for resolving ${...}
|
||||
* placeholder and #{...} SpEL expressions in default values;
|
||||
* or {@code null} if default values are not expected to have expressions
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
/**
|
||||
* Strategy interface for resolving method parameters into argument values in
|
||||
* Strategy interface for resolving method parameters into argument values in
|
||||
* the context of a given request.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
@@ -31,25 +31,25 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
public interface HandlerMethodArgumentResolver {
|
||||
|
||||
/**
|
||||
* Whether the given {@linkplain MethodParameter method parameter} is
|
||||
* Whether the given {@linkplain MethodParameter method parameter} is
|
||||
* supported by this resolver.
|
||||
*
|
||||
*
|
||||
* @param parameter the method parameter to check
|
||||
* @return {@code true} if this resolver supports the supplied parameter;
|
||||
* @return {@code true} if this resolver supports the supplied parameter;
|
||||
* {@code false} otherwise
|
||||
*/
|
||||
boolean supportsParameter(MethodParameter parameter);
|
||||
|
||||
/**
|
||||
* Resolves a method parameter into an argument value from a given request.
|
||||
* A {@link ModelAndViewContainer} provides access to the model for the
|
||||
* Resolves a method parameter into an argument value from a given request.
|
||||
* A {@link ModelAndViewContainer} provides access to the model for the
|
||||
* request. A {@link WebDataBinderFactory} provides a way to create
|
||||
* a {@link WebDataBinder} instance when needed for data binding and
|
||||
* a {@link WebDataBinder} instance when needed for data binding and
|
||||
* type conversion purposes.
|
||||
*
|
||||
* @param parameter the method parameter to resolve. This parameter must
|
||||
* have previously been passed to
|
||||
* {@link #supportsParameter(org.springframework.core.MethodParameter)}
|
||||
*
|
||||
* @param parameter the method parameter to resolve. This parameter must
|
||||
* have previously been passed to
|
||||
* {@link #supportsParameter(org.springframework.core.MethodParameter)}
|
||||
* and it must have returned {@code true}
|
||||
* @param mavContainer the ModelAndViewContainer for the current request
|
||||
* @param webRequest the current request
|
||||
@@ -57,9 +57,9 @@ public interface HandlerMethodArgumentResolver {
|
||||
* @return the resolved argument value, or {@code null}.
|
||||
* @throws Exception in case of errors with the preparation of argument values
|
||||
*/
|
||||
Object resolveArgument(MethodParameter parameter,
|
||||
Object resolveArgument(MethodParameter parameter,
|
||||
ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest,
|
||||
NativeWebRequest webRequest,
|
||||
WebDataBinderFactory binderFactory) throws Exception;
|
||||
|
||||
}
|
||||
@@ -20,8 +20,8 @@ import org.springframework.core.MethodParameter;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
|
||||
/**
|
||||
* Strategy interface to handle the value returned from the invocation of a
|
||||
* handler method .
|
||||
* Strategy interface to handle the value returned from the invocation of a
|
||||
* handler method .
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 3.1
|
||||
@@ -29,25 +29,25 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
public interface HandlerMethodReturnValueHandler {
|
||||
|
||||
/**
|
||||
* Whether the given {@linkplain MethodParameter method return type} is
|
||||
* Whether the given {@linkplain MethodParameter method return type} is
|
||||
* supported by this handler.
|
||||
*
|
||||
* @param returnType the method return type to check
|
||||
* @return {@code true} if this handler supports the supplied return type;
|
||||
* @return {@code true} if this handler supports the supplied return type;
|
||||
* {@code false} otherwise
|
||||
*/
|
||||
boolean supportsReturnType(MethodParameter returnType);
|
||||
|
||||
/**
|
||||
* Handle the given return value by adding attributes to the model and
|
||||
* setting a view or setting the
|
||||
* Handle the given return value by adding attributes to the model and
|
||||
* setting a view or setting the
|
||||
* {@link ModelAndViewContainer#setRequestHandled} flag to {@code true}
|
||||
* to indicate the response has been handled directly.
|
||||
*
|
||||
* to indicate the response has been handled directly.
|
||||
*
|
||||
* @param returnValue the value returned from the handler method
|
||||
* @param returnType the type of the return value. This type must have
|
||||
* previously been passed to
|
||||
* {@link #supportsReturnType(org.springframework.core.MethodParameter)}
|
||||
* @param returnType the type of the return value. This type must have
|
||||
* previously been passed to
|
||||
* {@link #supportsReturnType(org.springframework.core.MethodParameter)}
|
||||
* and it must have returned {@code true}
|
||||
* @param mavContainer the ModelAndViewContainer for the current request
|
||||
* @param webRequest the current request
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MultipartFilter extends OncePerRequestFilter {
|
||||
logger.debug("Request [" + processedRequest.getRequestURI() + "] is not a multipart request");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
filterChain.doFilter(processedRequest, response);
|
||||
}
|
||||
|
||||
@@ -51,15 +51,15 @@ public class RequestPartServletServerHttpRequest extends ServletServerHttpReques
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
* Create a new instance.
|
||||
* @param request the current request
|
||||
* @param partName the name of the part to adapt to the {@link ServerHttpRequest} contract
|
||||
* @throws MissingServletRequestPartException if the request part cannot be found
|
||||
* @throws IllegalArgumentException if MultipartHttpServletRequest cannot be initialized
|
||||
*/
|
||||
public RequestPartServletServerHttpRequest(HttpServletRequest request, String partName)
|
||||
public RequestPartServletServerHttpRequest(HttpServletRequest request, String partName)
|
||||
throws MissingServletRequestPartException {
|
||||
|
||||
|
||||
super(request);
|
||||
|
||||
this.multipartRequest = asMultipartRequest(request);
|
||||
@@ -78,7 +78,7 @@ public class RequestPartServletServerHttpRequest extends ServletServerHttpReques
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static MultipartHttpServletRequest asMultipartRequest(HttpServletRequest request) {
|
||||
if (request instanceof MultipartHttpServletRequest) {
|
||||
return (MultipartHttpServletRequest) request;
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
/**
|
||||
* Custom {@link java.beans.PropertyEditor} for converting
|
||||
* {@link MultipartFile MultipartFiles} to Strings.
|
||||
*
|
||||
*
|
||||
* <p>Allows one to specify the charset to use.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class TagUtils {
|
||||
* 'page' or 'application', the method will return {@link PageContext#PAGE_SCOPE}.
|
||||
* @param scope the <code>String</code> to inspect
|
||||
* @return the scope found, or {@link PageContext#PAGE_SCOPE} if no scope matched
|
||||
* @throws IllegalArgumentException if the supplied <code>scope</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if the supplied <code>scope</code> is <code>null</code>
|
||||
*/
|
||||
public static int getScope(String scope) {
|
||||
Assert.notNull(scope, "Scope to search for cannot be null");
|
||||
@@ -90,7 +90,7 @@ public abstract class TagUtils {
|
||||
* of the supplied type
|
||||
* @throws IllegalArgumentException if either of the supplied arguments is <code>null</code>;
|
||||
* or if the supplied <code>ancestorTagClass</code> is not type-assignable to
|
||||
* the {@link Tag} class
|
||||
* the {@link Tag} class
|
||||
*/
|
||||
public static boolean hasAncestorOfType(Tag tag, Class ancestorTagClass) {
|
||||
Assert.notNull(tag, "Tag cannot be null");
|
||||
@@ -122,7 +122,7 @@ public abstract class TagUtils {
|
||||
* @throws IllegalArgumentException if any of the supplied arguments is <code>null</code>,
|
||||
* or in the case of the {@link String}-typed arguments, is composed wholly
|
||||
* of whitespace; or if the supplied <code>ancestorTagClass</code> is not
|
||||
* type-assignable to the {@link Tag} class
|
||||
* type-assignable to the {@link Tag} class
|
||||
* @see #hasAncestorOfType(javax.servlet.jsp.tagext.Tag, Class)
|
||||
*/
|
||||
public static void assertHasAncestorOfType(Tag tag, Class ancestorTagClass, String tagName, String ancestorTagName) {
|
||||
|
||||
@@ -70,8 +70,8 @@ public abstract class UriUtils {
|
||||
/**
|
||||
* Encodes the given source URI into an encoded String. All various URI components are
|
||||
* encoded according to their respective valid character sets.
|
||||
* <p><strong>Note</strong> that this method does not attempt to encode "=" and "&"
|
||||
* characters in query parameter names and query parameter values because they cannot
|
||||
* <p><strong>Note</strong> that this method does not attempt to encode "=" and "&"
|
||||
* characters in query parameter names and query parameter values because they cannot
|
||||
* be parsed in a reliable way. Instead use:
|
||||
* <pre>
|
||||
* UriComponents uriComponents = UriComponentsBuilder.fromUri("/path?name={value}").buildAndExpand("a=b");
|
||||
@@ -111,8 +111,8 @@ public abstract class UriUtils {
|
||||
* encoded according to their respective valid character sets.
|
||||
* <p><strong>Note</strong> that this method does not support fragments ({@code #}),
|
||||
* as these are not supposed to be sent to the server, but retained by the client.
|
||||
* <p><strong>Note</strong> that this method does not attempt to encode "=" and "&"
|
||||
* characters in query parameter names and query parameter values because they cannot
|
||||
* <p><strong>Note</strong> that this method does not attempt to encode "=" and "&"
|
||||
* characters in query parameter names and query parameter values because they cannot
|
||||
* be parsed in a reliable way. Instead use:
|
||||
* <pre>
|
||||
* UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl("/path?name={value}").buildAndExpand("a=b");
|
||||
|
||||
Reference in New Issue
Block a user