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:
Phillip Webb
2012-12-18 13:45:00 -08:00
committed by Chris Beams
parent 44a474a014
commit 1762157ad1
1400 changed files with 5920 additions and 5923 deletions

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -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>

View File

@@ -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

View File

@@ -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;

View File

@@ -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();
}
}

View File

@@ -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
*/

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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());

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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.
*

View File

@@ -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.
*

View File

@@ -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

View File

@@ -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
*/

View File

@@ -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());
}
}
}
}

View File

@@ -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()));
}
}

View File

@@ -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()));
}
}

View File

@@ -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
*/

View File

@@ -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;
}

View File

@@ -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

View File

@@ -114,7 +114,7 @@ public class MultipartFilter extends OncePerRequestFilter {
logger.debug("Request [" + processedRequest.getRequestURI() + "] is not a multipart request");
}
}
try {
filterChain.doFilter(processedRequest, response);
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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) {

View File

@@ -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");

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -1,13 +1,13 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -56,7 +56,7 @@ public class HttpMessageConverterTests {
assertFalse(converter.canRead(MyType.class, new MediaType("foo", "*")));
assertFalse(converter.canRead(MyType.class, MediaType.ALL));
}
@Test
public void canWrite() {
AbstractHttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(MEDIA_TYPE) {

View File

@@ -87,7 +87,7 @@ public class StringHttpMessageConverterTests {
}
// SPR-8867
@Test
public void writeOverrideRequestedContentType() throws IOException {
Charset utf8 = Charset.forName("UTF-8");

View File

@@ -56,7 +56,7 @@ public class Jaxb2RootElementHttpMessageConverterTest {
AopProxy proxy = proxyFactory.createAopProxy(advisedSupport);
rootElementCglib = (RootElement) proxy.getProxy();
}
@Test
public void canRead() throws Exception {
assertTrue("Converter does not support reading @XmlRootElement", converter.canRead(RootElement.class, null));
@@ -79,7 +79,7 @@ public class Jaxb2RootElementHttpMessageConverterTest {
RootElement result = (RootElement) converter.read((Class) RootElement.class, inputMessage);
assertEquals("Invalid result", "Hello World", result.type.s);
}
@Test
@SuppressWarnings("unchecked")
public void readXmlRootElementSubclass() throws Exception {

View File

@@ -120,7 +120,7 @@ public class SourceHttpMessageConverterTests {
assertEquals("Invalid content-length", outputMessage.getBodyAsBytes().length,
outputMessage.getHeaders().getContentLength());
}
@Test
public void writeSAXSource() throws Exception {
String xml = "<root>Hello World</root>";

View File

@@ -71,7 +71,7 @@ public class MockHttpSession implements HttpSession {
/**
* Create a new MockHttpSession with a default {@link MockServletContext}.
*
*
* @see MockServletContext
*/
public MockHttpSession() {
@@ -80,7 +80,7 @@ public class MockHttpSession implements HttpSession {
/**
* Create a new MockHttpSession.
*
*
* @param servletContext the ServletContext that the session runs in
*/
public MockHttpSession(ServletContext servletContext) {
@@ -89,7 +89,7 @@ public class MockHttpSession implements HttpSession {
/**
* Create a new MockHttpSession.
*
*
* @param servletContext the ServletContext that the session runs in
* @param id a unique identifier for this session
*/
@@ -222,7 +222,7 @@ public class MockHttpSession implements HttpSession {
/**
* Serialize the attributes of this session into an object that can be
* turned into a byte array with standard Java serialization.
*
*
* @return a representation of this session's serialized state
*/
public Serializable serializeState() {
@@ -249,7 +249,7 @@ public class MockHttpSession implements HttpSession {
/**
* Deserialize the attributes of this session from a state object created by
* {@link #serializeState()}.
*
*
* @param state a representation of this session's serialized state
*/
@SuppressWarnings("unchecked")

View File

@@ -72,7 +72,7 @@ public class RequestAndSessionScopedBeanTests {
// expected
}
}
@Test
public void testPutBeanInSession() throws Exception {
String targetBeanName = "target";

View File

@@ -41,16 +41,16 @@ public class RequestContextFilterTests extends TestCase {
public void testHappyPath() throws Exception {
testFilterInvocation(null);
}
public void testWithException() throws Exception {
testFilterInvocation(new ServletException());
}
public void testFilterInvocation(final ServletException sex) throws Exception {
final MockHttpServletRequest req = new MockHttpServletRequest();
req.setAttribute("myAttr", "myValue");
final MockHttpServletResponse resp = new MockHttpServletResponse();
// Expect one invocation by the filter being tested
class DummyFilterChain implements FilterChain {
public int invocations = 0;
@@ -84,7 +84,7 @@ public class RequestContextFilterTests extends TestCase {
catch (ServletException ex) {
assertNotNull(sex);
}
try {
RequestContextHolder.currentRequestAttributes();
fail();

View File

@@ -38,7 +38,7 @@ import org.springframework.web.method.annotation.AbstractCookieValueMethodArgume
/**
* Test fixture with {@link org.springframework.web.method.annotation.AbstractCookieValueMethodArgumentResolver}.
*
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@@ -59,7 +59,7 @@ public class CookieValueMethodArgumentResolverTests {
@Before
public void setUp() throws Exception {
resolver = new TestCookieValueMethodArgumentResolver();
Method method = getClass().getMethod("params", Cookie.class, String.class, String.class);
paramNamedCookie = new MethodParameter(method, 0);
paramNamedDefaultValueString = new MethodParameter(method, 1);
@@ -79,7 +79,7 @@ public class CookieValueMethodArgumentResolverTests {
@Test
public void resolveCookieDefaultValue() throws Exception {
Object result = resolver.resolveArgument(paramNamedDefaultValueString, null, webRequest, null);
assertTrue(result instanceof String);
assertEquals("Invalid result", "bar", result);
}
@@ -101,7 +101,7 @@ public class CookieValueMethodArgumentResolverTests {
return null;
}
}
public void params(@CookieValue("name") Cookie param1,
@CookieValue(value = "name", defaultValue = "bar") String param2,
String param3) {

View File

@@ -32,7 +32,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
/**
* Test fixture with {@link ErrorsMethodArgumentResolver}.
*
*
* @author Rossen Stoyanchev
*/
public class ErrorsMethodHandlerArgumentResolverTests {
@@ -66,7 +66,7 @@ public class ErrorsMethodHandlerArgumentResolverTests {
mavContainer.addAttribute("ignore4", "value4");
mavContainer.addAttribute("ignore5", "value5");
mavContainer.addAllAttributes(bindingResult.getModel());
Object actual = resolver.resolveArgument(paramErrors, mavContainer, webRequest, null);
assertSame(actual, bindingResult);
@@ -77,10 +77,10 @@ public class ErrorsMethodHandlerArgumentResolverTests {
ModelAndViewContainer mavContainer = new ModelAndViewContainer();
mavContainer.addAllAttributes(bindingResult.getModel());
mavContainer.addAttribute("ignore1", "value1");
resolver.resolveArgument(paramErrors, mavContainer, webRequest, null);
}
@Test(expected=IllegalStateException.class)
public void noBindingResult() throws Exception {
resolver.resolveArgument(paramErrors, new ModelAndViewContainer(), webRequest, null);

View File

@@ -34,7 +34,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
/**
* Test fixture for {@link ExceptionHandlerMethodResolver} tests.
*
*
* @author Rossen Stoyanchev
*/
public class ExceptionHandlerMethodResolverTests {
@@ -83,7 +83,7 @@ public class ExceptionHandlerMethodResolverTests {
IOException exception = new IOException();
assertEquals("handleIOException", resolver.resolveMethod(exception).getName());
}
@Test(expected = IllegalStateException.class)
public void ambiguousExceptionMapping() {
new ExceptionHandlerMethodResolver(AmbiguousController.class);
@@ -96,7 +96,7 @@ public class ExceptionHandlerMethodResolverTests {
@Controller
static class ExceptionController {
public void handle() {}
@ExceptionHandler(IOException.class)
@@ -139,10 +139,10 @@ public class ExceptionHandlerMethodResolverTests {
@Controller
static class NoExceptionController {
@ExceptionHandler
public void handle() {
}
}
}

View File

@@ -37,7 +37,7 @@ import org.springframework.web.method.annotation.ExpressionValueMethodArgumentRe
/**
* Test fixture with {@link ExpressionValueMethodArgumentResolver}.
*
*
* @author Rossen Stoyanchev
*/
public class ExpressionValueMethodArgumentResolverTests {
@@ -57,18 +57,18 @@ public class ExpressionValueMethodArgumentResolverTests {
GenericWebApplicationContext context = new GenericWebApplicationContext();
context.refresh();
resolver = new ExpressionValueMethodArgumentResolver(context.getBeanFactory());
Method method = getClass().getMethod("params", int.class, String.class, String.class);
paramSystemProperty = new MethodParameter(method, 0);
paramContextPath = new MethodParameter(method, 1);
paramNotSupported = new MethodParameter(method, 2);
webRequest = new ServletWebRequest(new MockHttpServletRequest(), new MockHttpServletResponse());
// Expose request to the current thread (for SpEL expressions)
RequestContextHolder.setRequestAttributes(webRequest);
}
@After
public void teardown() {
RequestContextHolder.resetRequestAttributes();
@@ -86,7 +86,7 @@ public class ExpressionValueMethodArgumentResolverTests {
System.setProperty("systemProperty", "22");
Object value = resolver.resolveArgument(paramSystemProperty, null, webRequest, null);
System.clearProperty("systemProperty");
assertEquals("22", value);
}
@@ -94,7 +94,7 @@ public class ExpressionValueMethodArgumentResolverTests {
public void resolveContextPath() throws Exception {
webRequest.getNativeRequest(MockHttpServletRequest.class).setContextPath("/contextPath");
Object value = resolver.resolveArgument(paramContextPath, null, webRequest, null);
assertEquals("/contextPath", value);
}

View File

@@ -53,19 +53,19 @@ public class InitBinderDataBinderFactoryTests {
private HandlerMethodArgumentResolverComposite argumentResolvers;
private NativeWebRequest webRequest;
@Before
public void setUp() throws Exception {
bindingInitializer = new ConfigurableWebBindingInitializer();
argumentResolvers = new HandlerMethodArgumentResolverComposite();
webRequest = new ServletWebRequest(new MockHttpServletRequest());
}
@Test
public void createBinder() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinder", WebDataBinder.class);
WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
assertNotNull(dataBinder.getDisallowedFields());
assertEquals("id", dataBinder.getDisallowedFields()[0]);
}
@@ -74,10 +74,10 @@ public class InitBinderDataBinderFactoryTests {
public void createBinderWithGlobalInitialization() throws Exception {
ConversionService conversionService = new DefaultFormattingConversionService();
bindingInitializer.setConversionService(conversionService);
WebDataBinderFactory factory = createBinderFactory("initBinder", WebDataBinder.class);
WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
assertSame(conversionService, dataBinder.getConversionService());
}
@@ -85,7 +85,7 @@ public class InitBinderDataBinderFactoryTests {
public void createBinderWithAttrName() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = factory.createBinder(webRequest, null, "foo");
assertNotNull(dataBinder.getDisallowedFields());
assertEquals("id", dataBinder.getDisallowedFields()[0]);
}
@@ -94,18 +94,18 @@ public class InitBinderDataBinderFactoryTests {
public void createBinderWithAttrNameNoMatch() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = factory.createBinder(webRequest, null, "invalidName");
assertNull(dataBinder.getDisallowedFields());
}
@Test
public void createBinderNullAttrName() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);
assertNull(dataBinder.getDisallowedFields());
}
@Test(expected=IllegalStateException.class)
public void returnValueNotExpected() throws Exception {
WebDataBinderFactory factory = createBinderFactory("initBinderReturnValue", WebDataBinder.class);
@@ -123,7 +123,7 @@ public class InitBinderDataBinderFactoryTests {
assertNotNull(dataBinder.getDisallowedFields());
assertEquals("requestParam-22", dataBinder.getDisallowedFields()[0]);
}
private WebDataBinderFactory createBinderFactory(String methodName, Class<?>... parameterTypes)
throws Exception {
@@ -134,9 +134,9 @@ public class InitBinderDataBinderFactoryTests {
handlerMethod.setHandlerMethodArgumentResolvers(argumentResolvers);
handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null));
handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());
return new InitBinderDataBinderFactory(Arrays.asList(handlerMethod), bindingInitializer);
}
}
private static class InitBinderHandler {
@@ -145,24 +145,24 @@ public class InitBinderDataBinderFactoryTests {
public void initBinder(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id");
}
@SuppressWarnings("unused")
@InitBinder(value="foo")
public void initBinderWithAttributeName(WebDataBinder dataBinder) {
dataBinder.setDisallowedFields("id");
}
@SuppressWarnings("unused")
@InitBinder
public String initBinderReturnValue(WebDataBinder dataBinder) {
return "invalid";
}
@SuppressWarnings("unused")
@InitBinder
public void initBinderTypeConversion(WebDataBinder dataBinder, @RequestParam int requestParam) {
dataBinder.setDisallowedFields("requestParam-" + requestParam);
}
}
}

View File

@@ -35,15 +35,15 @@ import org.springframework.web.method.support.ModelAndViewContainer;
/**
* Test fixture with {@link org.springframework.web.method.annotation.MapMethodProcessor}.
*
*
* @author Rossen Stoyanchev
*/
public class MapMethodProcessorTests {
private MapMethodProcessor processor;
private ModelAndViewContainer mavContainer;
private MethodParameter paramMap;
private MethodParameter returnParamMap;
@@ -54,8 +54,8 @@ public class MapMethodProcessorTests {
public void setUp() throws Exception {
processor = new MapMethodProcessor();
mavContainer = new ModelAndViewContainer();
Method method = getClass().getDeclaredMethod("map", Map.class);
Method method = getClass().getDeclaredMethod("map", Map.class);
paramMap = new MethodParameter(method, 0);
returnParamMap = new MethodParameter(method, 0);
@@ -76,12 +76,12 @@ public class MapMethodProcessorTests {
public void resolveArgumentValue() throws Exception {
assertSame(mavContainer.getModel(), processor.resolveArgument(paramMap, mavContainer, webRequest, null));
}
@Test
public void handleMapReturnValue() throws Exception {
mavContainer.addAttribute("attr1", "value1");
Map<String, Object> returnValue = new ModelMap("attr2", "value2");
processor.handleReturnValue(returnValue , returnParamMap, mavContainer, webRequest);
assertEquals("value1", mavContainer.getModel().get("attr1"));
@@ -92,5 +92,5 @@ public class MapMethodProcessorTests {
private Map<String, Object> map(Map<String, Object> map) {
return null;
}
}

View File

@@ -50,13 +50,13 @@ import org.springframework.web.method.support.ModelAndViewContainer;
/**
* Text fixture for {@link ModelFactory} tests.
*
*
* @author Rossen Stoyanchev
*/
public class ModelFactoryTests {
private Object handler = new ModelHandler();
private InvocableHandlerMethod handleMethod;
private InvocableHandlerMethod handleSessionAttrMethod;
@@ -77,13 +77,13 @@ public class ModelFactoryTests {
sessionAttrsHandler = new SessionAttributesHandler(handlerType, sessionAttributeStore);
webRequest = new ServletWebRequest(new MockHttpServletRequest());
}
@Test
public void modelAttributeMethod() throws Exception {
ModelFactory modelFactory = createModelFactory("modelAttr", Model.class);
ModelAndViewContainer mavContainer = new ModelAndViewContainer();
modelFactory.initModel(webRequest, mavContainer, handleMethod);
assertEquals(Boolean.TRUE, mavContainer.getModel().get("modelAttr"));
}
@@ -114,14 +114,14 @@ public class ModelFactoryTests {
assertTrue(mavContainer.containsAttribute("name"));
assertNull(mavContainer.getModel().get("name"));
}
@Test
public void sessionAttribute() throws Exception {
sessionAttributeStore.storeAttribute(webRequest, "sessionAttr", "sessionAttrValue");
// Resolve successfully handler session attribute once
assertTrue(sessionAttrsHandler.isHandlerSessionAttribute("sessionAttr", null));
ModelFactory modelFactory = createModelFactory("modelAttr", Model.class);
ModelAndViewContainer mavContainer = new ModelAndViewContainer();
modelFactory.initModel(webRequest, mavContainer, handleMethod);
@@ -137,7 +137,7 @@ public class ModelFactoryTests {
modelFactory.initModel(webRequest, new ModelAndViewContainer(), handleSessionAttrMethod);
fail("Expected HttpSessionRequiredException");
} catch (HttpSessionRequiredException e) { }
sessionAttributeStore.storeAttribute(webRequest, "sessionAttr", "sessionAttrValue");
ModelAndViewContainer mavContainer = new ModelAndViewContainer();
modelFactory.initModel(webRequest, mavContainer, handleSessionAttrMethod);
@@ -151,19 +151,19 @@ public class ModelFactoryTests {
Object attrValue = new Object();
ModelAndViewContainer mavContainer = new ModelAndViewContainer();
mavContainer.addAttribute(attrName, attrValue);
WebDataBinder dataBinder = new WebDataBinder(attrValue, attrName);
WebDataBinderFactory binderFactory = createMock(WebDataBinderFactory.class);
expect(binderFactory.createBinder(webRequest, attrValue, attrName)).andReturn(dataBinder);
replay(binderFactory);
ModelFactory modelFactory = new ModelFactory(null, binderFactory, sessionAttrsHandler);
modelFactory.updateModel(webRequest, mavContainer);
assertEquals(attrValue, mavContainer.getModel().remove(attrName));
assertSame(dataBinder.getBindingResult(), mavContainer.getModel().remove(bindingResultKey(attrName)));
assertEquals(0, mavContainer.getModel().size());
verify(binderFactory);
}
@@ -171,12 +171,12 @@ public class ModelFactoryTests {
public void updateModelSessionStatusComplete() throws Exception {
String attrName = "sessionAttr";
String attrValue = "sessionAttrValue";
ModelAndViewContainer mavContainer = new ModelAndViewContainer();
mavContainer.addAttribute(attrName, attrValue);
mavContainer.getSessionStatus().setComplete();
sessionAttributeStore.storeAttribute(webRequest, attrName, attrValue);
// Resolve successfully handler session attribute once
assertTrue(sessionAttrsHandler.isHandlerSessionAttribute(attrName, null));
@@ -193,11 +193,11 @@ public class ModelFactoryTests {
verify(binderFactory);
}
private String bindingResultKey(String key) {
return BindingResult.MODEL_KEY_PREFIX + key;
}
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception{
Method method = ModelHandler.class.getMethod(methodName, parameterTypes);
@@ -208,13 +208,13 @@ public class ModelFactoryTests {
handlerMethod.setHandlerMethodArgumentResolvers(argResolvers);
handlerMethod.setDataBinderFactory(null);
handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());
return new ModelFactory(Arrays.asList(handlerMethod), null, sessionAttrsHandler);
}
@SessionAttributes("sessionAttr") @SuppressWarnings("unused")
private static class ModelHandler {
@ModelAttribute
public void modelAttr(Model model) {
model.addAttribute("modelAttr", Boolean.TRUE);
@@ -234,7 +234,7 @@ public class ModelFactoryTests {
public Boolean nullModelAttr() {
return null;
}
public void handle() {
}

View File

@@ -35,15 +35,15 @@ import org.springframework.web.method.support.ModelAndViewContainer;
/**
* Test fixture with {@link org.springframework.web.method.annotation.ModelMethodProcessor}.
*
*
* @author Rossen Stoyanchev
*/
public class ModelMethodProcessorTests {
private ModelMethodProcessor processor;
private ModelAndViewContainer mavContainer;
private MethodParameter paramModel;
private MethodParameter returnParamModel;
@@ -54,11 +54,11 @@ public class ModelMethodProcessorTests {
public void setUp() throws Exception {
processor = new ModelMethodProcessor();
mavContainer = new ModelAndViewContainer();
Method method = getClass().getDeclaredMethod("model", Model.class);
Method method = getClass().getDeclaredMethod("model", Model.class);
paramModel = new MethodParameter(method, 0);
returnParamModel = new MethodParameter(method, -1);
webRequest = new ServletWebRequest(new MockHttpServletRequest());
}
@@ -76,7 +76,7 @@ public class ModelMethodProcessorTests {
public void resolveArgumentValue() throws Exception {
assertSame(mavContainer.getModel(), processor.resolveArgument(paramModel, mavContainer, webRequest, null));
}
@Test
public void handleModelReturnValue() throws Exception {
mavContainer.addAttribute("attr1", "value1");
@@ -84,14 +84,14 @@ public class ModelMethodProcessorTests {
returnValue.addAttribute("attr2", "value2");
processor.handleReturnValue(returnValue , returnParamModel, mavContainer, webRequest);
assertEquals("value1", mavContainer.getModel().get("attr1"));
assertEquals("value2", mavContainer.getModel().get("attr2"));
}
@SuppressWarnings("unused")
private Model model(Model model) {
return null;
}
}

View File

@@ -39,7 +39,7 @@ import org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentR
/**
* Text fixture with {@link RequestHeaderMapMethodArgumentResolver}.
*
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@@ -62,7 +62,7 @@ public class RequestHeaderMapMethodArgumentResolverTests {
@Before
public void setUp() throws Exception {
resolver = new RequestHeaderMapMethodArgumentResolver();
Method method = getClass().getMethod("params", Map.class, MultiValueMap.class, HttpHeaders.class, Map.class);
paramMap = new MethodParameter(method, 0);
paramMultiValueMap = new MethodParameter(method, 1);
@@ -108,7 +108,7 @@ public class RequestHeaderMapMethodArgumentResolverTests {
expected.add(name, value2);
Object result = resolver.resolveArgument(paramMultiValueMap, null, webRequest, null);
assertTrue(result instanceof MultiValueMap);
assertEquals("Invalid result", expected, result);
}
@@ -127,7 +127,7 @@ public class RequestHeaderMapMethodArgumentResolverTests {
expected.add(name, value2);
Object result = resolver.resolveArgument(paramHttpHeaders, null, webRequest, null);
assertTrue(result instanceof HttpHeaders);
assertEquals("Invalid result", expected, result);
}

View File

@@ -41,7 +41,7 @@ import org.springframework.web.method.annotation.RequestHeaderMethodArgumentReso
/**
* Test fixture with {@link org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver}.
*
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@@ -78,7 +78,7 @@ public class RequestHeaderMethodArgumentResolverTests {
// Expose request to the current thread (for SpEL expressions)
RequestContextHolder.setRequestAttributes(webRequest);
}
@After
public void teardown() {
RequestContextHolder.resetRequestAttributes();

View File

@@ -38,7 +38,7 @@ import org.springframework.web.method.annotation.RequestParamMapMethodArgumentRe
/**
* Test fixture with {@link RequestParamMapMethodArgumentResolver}.
*
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@@ -61,7 +61,7 @@ public class RequestParamMapMethodArgumentResolverTests {
@Before
public void setUp() throws Exception {
resolver = new RequestParamMapMethodArgumentResolver();
Method method = getClass().getMethod("params", Map.class, MultiValueMap.class, Map.class, Map.class);
paramMap = new MethodParameter(method, 0);
paramMultiValueMap = new MethodParameter(method, 1);
@@ -88,7 +88,7 @@ public class RequestParamMapMethodArgumentResolverTests {
Map<String, String> expected = Collections.singletonMap(name, value);
Object result = resolver.resolveArgument(paramMap, null, webRequest, null);
assertTrue(result instanceof Map);
assertEquals("Invalid result", expected, result);
}
@@ -99,7 +99,7 @@ public class RequestParamMapMethodArgumentResolverTests {
String value1 = "bar";
String value2 = "baz";
request.addParameter(name, new String[]{value1, value2});
MultiValueMap<String, String> expected = new LinkedMultiValueMap<String, String>(1);
expected.add(name, value1);
expected.add(name, value2);

View File

@@ -50,7 +50,7 @@ import org.springframework.web.multipart.MultipartFile;
/**
* Test fixture with {@link org.springframework.web.method.annotation.RequestParamMethodArgumentResolver}.
*
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@@ -81,7 +81,7 @@ public class RequestParamMethodArgumentResolverTests {
Method method = getClass().getMethod("params", String.class, String[].class, Map.class, MultipartFile.class,
Map.class, String.class, MultipartFile.class, List.class, Part.class, MultipartFile.class);
paramNamedDefaultValueString = new MethodParameter(method, 0);
paramNamedStringArray = new MethodParameter(method, 1);
paramNamedMap = new MethodParameter(method, 2);
@@ -112,7 +112,7 @@ public class RequestParamMethodArgumentResolverTests {
assertTrue("Simple type params supported w/o annotations", resolver.supportsParameter(paramStringNotAnnot));
assertTrue("MultipartFile parameter not supported", resolver.supportsParameter(paramMultipartFileNotAnnot));
assertTrue("Part parameter not supported", resolver.supportsParameter(paramServlet30Part));
resolver = new RequestParamMethodArgumentResolver(null, false);
assertFalse(resolver.supportsParameter(paramStringNotAnnot));
assertFalse(resolver.supportsParameter(paramRequestPartAnnot));
@@ -229,7 +229,7 @@ public class RequestParamMethodArgumentResolverTests {
@Test
public void resolveDefaultValue() throws Exception {
Object result = resolver.resolveArgument(paramNamedDefaultValueString, null, webRequest, null);
assertTrue(result instanceof String);
assertEquals("Invalid result", "bar", result);
}
@@ -250,7 +250,7 @@ public class RequestParamMethodArgumentResolverTests {
}
// SPR-8561
@Test
public void resolveSimpleTypeParamToNull() throws Exception {
Object result = resolver.resolveArgument(paramStringNotAnnot, null, webRequest, null);

View File

@@ -36,7 +36,7 @@ import org.springframework.web.context.request.ServletWebRequest;
/**
* Test fixture with {@link WebArgumentResolverAdapterTests}.
*
*
* @author Arjen Poutsma
* @author Rossen Stoyanchev
*/
@@ -56,7 +56,7 @@ public class WebArgumentResolverAdapterTests {
adapter = new TestWebArgumentResolverAdapter(adaptee);
parameter = new MethodParameter(getClass().getMethod("handle", Integer.TYPE), 0);
webRequest = new ServletWebRequest(new MockHttpServletRequest());
// Expose request to the current thread (for SpEL expressions)
RequestContextHolder.setRequestAttributes(webRequest);
}
@@ -151,7 +151,7 @@ public class WebArgumentResolverAdapterTests {
public void handle(int param) {
}
private class TestWebArgumentResolverAdapter extends AbstractWebArgumentResolverAdapter {
public TestWebArgumentResolverAdapter(WebArgumentResolver adaptee) {

View File

@@ -28,7 +28,7 @@ import org.springframework.core.MethodParameter;
/**
* Test fixture with {@link HandlerMethodArgumentResolverComposite}.
*
*
* @author Rossen Stoyanchev
*/
public class HandlerMethodArgumentResolverCompositeTests {
@@ -42,20 +42,20 @@ public class HandlerMethodArgumentResolverCompositeTests {
@Before
public void setUp() throws Exception {
resolvers = new HandlerMethodArgumentResolverComposite();
Method method = getClass().getDeclaredMethod("handle", Integer.class, String.class);
paramInt = new MethodParameter(method, 0);
paramStr = new MethodParameter(method, 1);
}
@Test
public void supportsParameter() throws Exception {
registerResolver(Integer.class, null);
assertTrue(this.resolvers.supportsParameter(paramInt));
assertFalse(this.resolvers.supportsParameter(paramStr));
}
@Test
public void resolveArgument() throws Exception {
registerResolver(Integer.class, Integer.valueOf(55));
@@ -63,7 +63,7 @@ public class HandlerMethodArgumentResolverCompositeTests {
assertEquals(Integer.valueOf(55), resolvedValue);
}
@Test
public void checkArgumentResolverOrder() throws Exception {
registerResolver(Integer.class, Integer.valueOf(1));
@@ -72,7 +72,7 @@ public class HandlerMethodArgumentResolverCompositeTests {
assertEquals("Didn't use the first registered resolver", Integer.valueOf(1), resolvedValue);
}
@Test(expected=IllegalArgumentException.class)
public void noSuitableArgumentResolver() throws Exception {
this.resolvers.resolveArgument(paramStr, null, null, null);

View File

@@ -27,7 +27,7 @@ import org.springframework.core.MethodParameter;
/**
* Test fixture with {@link HandlerMethodReturnValueHandlerComposite}.
*
*
* @author Rossen Stoyanchev
*/
public class HandlerMethodReturnValueHandlerCompositeTests {
@@ -35,7 +35,7 @@ public class HandlerMethodReturnValueHandlerCompositeTests {
private HandlerMethodReturnValueHandlerComposite handlers;
ModelAndViewContainer mavContainer;
private MethodParameter paramInt;
private MethodParameter paramStr;
@@ -43,11 +43,11 @@ public class HandlerMethodReturnValueHandlerCompositeTests {
@Before
public void setUp() throws Exception {
handlers = new HandlerMethodReturnValueHandlerComposite();
mavContainer = new ModelAndViewContainer();
mavContainer = new ModelAndViewContainer();
paramInt = new MethodParameter(getClass().getDeclaredMethod("handleInteger"), -1);
paramStr = new MethodParameter(getClass().getDeclaredMethod("handleString"), -1);
}
@Test
public void supportsReturnType() throws Exception {
registerHandler(Integer.class);
@@ -55,12 +55,12 @@ public class HandlerMethodReturnValueHandlerCompositeTests {
assertTrue(this.handlers.supportsReturnType(paramInt));
assertFalse(this.handlers.supportsReturnType(paramStr));
}
@Test
public void handleReturnValue() throws Exception {
StubReturnValueHandler handler = registerHandler(Integer.class);
this.handlers.handleReturnValue(Integer.valueOf(55), paramInt, mavContainer, null);
assertEquals(Integer.valueOf(55), handler.getReturnValue());
}
@@ -69,28 +69,28 @@ public class HandlerMethodReturnValueHandlerCompositeTests {
StubReturnValueHandler h1 = registerHandler(Integer.class);
StubReturnValueHandler h2 = registerHandler(Integer.class);
this.handlers.handleReturnValue(Integer.valueOf(55), paramInt, mavContainer, null);
assertEquals("Didn't use the 1st registered handler", Integer.valueOf(55), h1.getReturnValue());
assertNull("Shouldn't have use the 2nd registered handler", h2.getReturnValue());
}
@Test(expected=IllegalArgumentException.class)
public void noSuitableReturnValueHandler() throws Exception {
registerHandler(Integer.class);
this.handlers.handleReturnValue("value", paramStr, null, null);
}
private StubReturnValueHandler registerHandler(Class<?> returnType) {
StubReturnValueHandler handler = new StubReturnValueHandler(returnType);
handlers.addHandler(handler);
return handler;
}
@SuppressWarnings("unused")
private Integer handleInteger() {
return null;
}
@SuppressWarnings("unused")
private String handleString() {
return null;

View File

@@ -36,7 +36,7 @@ public class ModelAndViewContainerTests {
public void setup() {
this.mavContainer = new ModelAndViewContainer();
}
@Test
public void getModel() {
this.mavContainer.addAttribute("name", "value");
@@ -48,13 +48,13 @@ public class ModelAndViewContainerTests {
ModelMap redirectModel = new ModelMap("name", "redirectValue");
this.mavContainer.setRedirectModel(redirectModel);
this.mavContainer.addAttribute("name", "value");
assertEquals("Default model should be used if not in redirect scenario",
"value", this.mavContainer.getModel().get("name"));
this.mavContainer.setRedirectModelScenario(true);
assertEquals("Redirect model should be used in redirect scenario",
assertEquals("Redirect model should be used in redirect scenario",
"redirectValue", this.mavContainer.getModel().get("name"));
}
@@ -62,13 +62,13 @@ public class ModelAndViewContainerTests {
public void getModelIgnoreDefaultModelOnRedirect() {
this.mavContainer.addAttribute("name", "value");
this.mavContainer.setRedirectModelScenario(true);
assertEquals("Default model should be used since no redirect model was provided",
assertEquals("Default model should be used since no redirect model was provided",
1, this.mavContainer.getModel().size());
this.mavContainer.setIgnoreDefaultModelOnRedirect(true);
assertEquals("Empty model should be returned if no redirect model is available",
assertEquals("Empty model should be returned if no redirect model is available",
0, this.mavContainer.getModel().size());
}

View File

@@ -26,7 +26,7 @@ import org.springframework.web.context.request.NativeWebRequest;
/**
* Supports parameters of a given type and resolves them using a stub value.
* Also records the resolved parameter value.
*
*
* @author Rossen Stoyanchev
*/
public class StubArgumentResolver implements HandlerMethodArgumentResolver {
@@ -34,7 +34,7 @@ public class StubArgumentResolver implements HandlerMethodArgumentResolver {
private final Class<?> parameterType;
private final Object stubValue;
private List<MethodParameter> resolvedParameters = new ArrayList<MethodParameter>();
public StubArgumentResolver(Class<?> supportedParameterType, Object stubValue) {

View File

@@ -20,16 +20,16 @@ import org.springframework.core.MethodParameter;
import org.springframework.web.context.request.NativeWebRequest;
/**
* Supports a fixed return value type. Records the last handled return value.
*
* Supports a fixed return value type. Records the last handled return value.
*
* @author Rossen Stoyanchev
*/
public class StubReturnValueHandler implements HandlerMethodReturnValueHandler {
private final Class<?> returnType;
private Object returnValue;
public StubReturnValueHandler(Class<?> returnType) {
this.returnType = returnType;
}

View File

@@ -36,19 +36,19 @@ import static org.junit.Assert.*;
public class RequestPartServletServerHttpRequestTests {
private RequestPartServletServerHttpRequest request;
private MockMultipartHttpServletRequest mockRequest;
private MockMultipartFile mockFile;
@Before
public void create() throws Exception {
mockFile = new MockMultipartFile("part", "", "application/json" ,"Part Content".getBytes("UTF-8"));
mockRequest = new MockMultipartHttpServletRequest();
mockRequest.addFile(mockFile);
request = new RequestPartServletServerHttpRequest(mockRequest, "part");
}
}
@Test
public void getMethod() throws Exception {
mockRequest.setMethod("POST");
@@ -80,5 +80,5 @@ public class RequestPartServletServerHttpRequestTests {
byte[] result = FileCopyUtils.copyToByteArray(request.getBody());
assertArrayEquals("Invalid content returned", mockFile.getBytes(), result);
}
}

View File

@@ -50,7 +50,7 @@ public class Log4jWebConfigurerTests {
public void initLoggingWithClasspathResourceAndRefreshInterval() {
initLogging(CLASSPATH_RESOURCE, true);
}
@Test
public void initLoggingWithRelativeFilePath() {
initLogging(RELATIVE_PATH, false);
@@ -119,11 +119,11 @@ public class Log4jWebConfigurerTests {
@Test
public void testLog4jConfigListener() {
Log4jConfigListener listener = new Log4jConfigListener();
MockServletContext sc = new MockServletContext("", new FileSystemResourceLoader());
sc.addInitParameter(Log4jWebConfigurer.CONFIG_LOCATION_PARAM, RELATIVE_PATH);
listener.contextInitialized(new ServletContextEvent(sc));
try {
assertLogOutput();
} finally {

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2002-2005 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -1,12 +1,12 @@
/*
* Copyright 2002-2006 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.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@@ -45,7 +45,7 @@ public class UriComponentsTests {
UriComponents uriComponents = UriComponentsBuilder.fromUriString("http://example.com/hotel list/Z\u00fcrich").build();
assertEquals(new URI("http://example.com/hotel%20list/Z\u00fcrich"), uriComponents.toUri());
}
@Test
public void expand() {
UriComponents uriComponents = UriComponentsBuilder.fromUriString("http://example.com").path("/{foo} {bar}").build();
@@ -63,7 +63,7 @@ public class UriComponentsTests {
public void invalidCharacters() {
UriComponentsBuilder.fromPath("/{foo}").build(true);
}
@Test(expected = IllegalArgumentException.class)
public void invalidEncodedSequence() {
UriComponentsBuilder.fromPath("/fo%2o").build(true);

View File

@@ -80,7 +80,7 @@ public class UriTemplateTests {
URI result = template.expand(uriVariables);
assertEquals("Invalid expanded template", new URI("http://example.com/hotels/1/bookings/42"), result);
}
@Test
public void expandMapEncoded() throws Exception {
Map<String, String> uriVariables = Collections.singletonMap("hotel", "Z\u00fcrich");
@@ -113,7 +113,7 @@ public class UriTemplateTests {
assertFalse("UriTemplate matches", template.matches(""));
assertFalse("UriTemplate matches", template.matches(null));
}
@Test
public void matchesCustomRegex() throws Exception {
UriTemplate template = new UriTemplate("http://example.com/hotels/{hotel:\\d+}");

View File

@@ -29,7 +29,7 @@ public class UriUtilsTests {
private static final String ENC = "UTF-8";
@Test
public void encodeScheme() throws UnsupportedEncodingException {