diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java index 480bb4a3b7e5..e96965093ea8 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java @@ -22,7 +22,6 @@ import java.util.List; import java.util.Map; import java.util.Set; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -72,7 +71,8 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping { private final Map handlerMap = new LinkedHashMap(); private MappedInterceptors mappedInterceptors; - + + /** * Set if URL lookup should always use the full path within the current servlet * context. Else, the path within the current servlet mapping is used if applicable @@ -164,10 +164,11 @@ public void setMappedInterceptors(MappedInterceptor[] mappedInterceptors) { @Override protected void initInterceptors() { super.initInterceptors(); - - Map mappedInterceptors = BeanFactoryUtils.beansOfTypeIncludingAncestors(getApplicationContext(), MappedInterceptor.class, true, false); + Map mappedInterceptors = BeanFactoryUtils.beansOfTypeIncludingAncestors( + getApplicationContext(), MappedInterceptor.class, true, false); if (!mappedInterceptors.isEmpty()) { - this.mappedInterceptors = new MappedInterceptors(mappedInterceptors.values().toArray(new MappedInterceptor[mappedInterceptors.size()])); + this.mappedInterceptors = new MappedInterceptors(mappedInterceptors.values().toArray( + new MappedInterceptor[mappedInterceptors.size()])); } } @@ -201,8 +202,9 @@ protected Object getHandlerInternal(HttpServletRequest request) throws Exception handler = buildPathExposingHandler(rawHandler, lookupPath, lookupPath, null); } } - if (handler != null & this.mappedInterceptors != null) { - Set mappedInterceptors = this.mappedInterceptors.getInterceptors(lookupPath, this.pathMatcher); + if (handler != null && this.mappedInterceptors != null) { + Set mappedInterceptors = + this.mappedInterceptors.getInterceptors(lookupPath, this.pathMatcher); if (!mappedInterceptors.isEmpty()) { HandlerExecutionChain chain; if (handler instanceof HandlerExecutionChain) { @@ -435,6 +437,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons } } + /** * Special interceptor for exposing the * {@link AbstractUrlHandlerMapping#URI_TEMPLATE_VARIABLES_ATTRIBUTE} attribute. diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java index 60260be38207..f1ba8a303b95 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.servlet.handler; import org.springframework.web.context.request.WebRequestInterceptor; @@ -20,6 +21,7 @@ /** * Holds information about a HandlerInterceptor mapped to a path into the application. + * * @author Keith Donald * @since 3.0 */ @@ -29,9 +31,10 @@ public final class MappedInterceptor { private final HandlerInterceptor interceptor; + /** - * Creates a new mapped interceptor. - * @param pathPattern the path pattern + * Create a new mapped interceptor. + * @param pathPatterns the path patterns * @param interceptor the interceptor */ public MappedInterceptor(String[] pathPatterns, HandlerInterceptor interceptor) { @@ -40,8 +43,8 @@ public MappedInterceptor(String[] pathPatterns, HandlerInterceptor interceptor) } /** - * Creates a new mapped interceptor. - * @param pathPattern the path pattern + * Create a new mapped interceptor. + * @param pathPatterns the path patterns * @param interceptor the interceptor */ public MappedInterceptor(String[] pathPatterns, WebRequestInterceptor interceptor) { @@ -49,18 +52,19 @@ public MappedInterceptor(String[] pathPatterns, WebRequestInterceptor intercepto this.interceptor = new WebRequestHandlerInterceptorAdapter(interceptor); } + /** * The path into the application the interceptor is mapped to. */ public String[] getPathPatterns() { - return pathPatterns; + return this.pathPatterns; } /** * The actual Interceptor reference. */ public HandlerInterceptor getInterceptor() { - return interceptor; + return this.interceptor; } -} \ No newline at end of file +} diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java index 068f9bd461ee..292d0176ea4c 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractCheckedElementTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.web.servlet.tags.form; import java.beans.PropertyEditor; - import javax.servlet.jsp.JspException; /** @@ -52,7 +51,7 @@ protected void renderFromValue(Object item, Object value, TagWriter tagWriter) t tagWriter.writeAttribute("checked", "checked"); } } - + /** * Determines whether the supplied value matched the selected value * through delegating to {@link SelectedValueComparator#isSelected}. @@ -68,7 +67,7 @@ private boolean isOptionSelected(Object value) throws JspException { */ protected void renderFromBoolean(Boolean boundValue, TagWriter tagWriter) throws JspException { tagWriter.writeAttribute("value", "true"); - if (boundValue.booleanValue()) { + if (boundValue) { tagWriter.writeAttribute("checked", "checked"); } } diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java index 06a83f02b84d..85b629556e6b 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/tags/form/AbstractMultiCheckedElementTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -19,7 +19,6 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map; - import javax.servlet.jsp.JspException; import org.springframework.beans.BeanWrapper; @@ -103,13 +102,17 @@ public void setItemValue(String itemValue) { this.itemValue = itemValue; } + /** + * Get the name of the property mapped to the 'value' attribute + * of the 'input type="checkbox/radio"' tag. + */ protected String getItemValue() { return this.itemValue; } /** - * Set the value to be displayed as part - * of the 'input type="checkbox/radio"' tag. + * Set the value to be displayed as part of the + * 'input type="checkbox/radio"' tag. *

May be a runtime expression. */ public void setItemLabel(String itemLabel) { @@ -118,8 +121,8 @@ public void setItemLabel(String itemLabel) { } /** - * Get the value to be displayed as part - * of the 'input type="checkbox/radio"' tag. + * Get the value to be displayed as part of the + * 'input type="checkbox/radio"' tag. */ protected String getItemLabel() { return this.itemLabel; @@ -183,7 +186,7 @@ protected String resolveId() throws JspException { @Override protected int writeTagContent(TagWriter tagWriter) throws JspException { Object items = getItems(); - Object itemsObject = (items instanceof String ? evaluate("items", (String) items) : items); + Object itemsObject = (items instanceof String ? evaluate("items", items) : items); String itemValue = getItemValue(); String itemLabel = getItemLabel(); diff --git a/org.springframework.web/src/main/java/org/springframework/http/converter/HttpMessageConverter.java b/org.springframework.web/src/main/java/org/springframework/http/converter/HttpMessageConverter.java index 0000a48be729..3981af589e4b 100644 --- a/org.springframework.web/src/main/java/org/springframework/http/converter/HttpMessageConverter.java +++ b/org.springframework.web/src/main/java/org/springframework/http/converter/HttpMessageConverter.java @@ -33,7 +33,6 @@ public interface HttpMessageConverter { /** * Indicates whether the given class can be read by this converter. - * * @param clazz the class to test for readability * @param mediaType the media type to read, can be {@code null} if not specified * @return true if readable; false otherwise @@ -42,7 +41,6 @@ public interface HttpMessageConverter { /** * Indicates whether the given class can be written by this converter. - * * @param clazz the class to test for writability * @param mediaType the media type to write, can be {@code null} if not specified * @return true if writable; false otherwise @@ -51,14 +49,12 @@ public interface HttpMessageConverter { /** * Return the list of {@link MediaType} objects supported by this converter. - * * @return the list of supported media types */ List getSupportedMediaTypes(); /** * Read an object of the given type form the given input message, and returns it. - * * @param clazz the type of object to return. This type must have previously been passed to the {@link #canRead * canRead} method of this interface, which must have returned {@code true}. * @param inputMessage the HTTP input message to read from diff --git a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java index cf25001540a4..92715fe88421 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java +++ b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java @@ -81,8 +81,8 @@ * * @author Juergen Hoeller * @author Arjen Poutsma - * @see #invokeHandlerMethod * @since 2.5.2 + * @see #invokeHandlerMethod */ public class HandlerMethodInvoker { @@ -103,6 +103,7 @@ public class HandlerMethodInvoker { private final SimpleSessionStatus sessionStatus = new SimpleSessionStatus(); + public HandlerMethodInvoker(HandlerMethodResolver methodResolver) { this(methodResolver, null); } @@ -111,12 +112,9 @@ public HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInit this(methodResolver, bindingInitializer, new DefaultSessionAttributeStore(), null, null, null); } - public HandlerMethodInvoker(HandlerMethodResolver methodResolver, - WebBindingInitializer bindingInitializer, - SessionAttributeStore sessionAttributeStore, - ParameterNameDiscoverer parameterNameDiscoverer, - WebArgumentResolver[] customArgumentResolvers, - HttpMessageConverter[] messageConverters) { + public HandlerMethodInvoker(HandlerMethodResolver methodResolver, WebBindingInitializer bindingInitializer, + SessionAttributeStore sessionAttributeStore, ParameterNameDiscoverer parameterNameDiscoverer, + WebArgumentResolver[] customArgumentResolvers, HttpMessageConverter[] messageConverters) { this.methodResolver = methodResolver; this.bindingInitializer = bindingInitializer; @@ -126,10 +124,9 @@ public HandlerMethodInvoker(HandlerMethodResolver methodResolver, this.messageConverters = messageConverters; } - public final Object invokeHandlerMethod(Method handlerMethod, - Object handler, - NativeWebRequest webRequest, - ExtendedModelMap implicitModel) throws Exception { + + public final Object invokeHandlerMethod(Method handlerMethod, Object handler, + NativeWebRequest webRequest, ExtendedModelMap implicitModel) throws Exception { Method handlerMethodToInvoke = BridgeMethodResolver.findBridgedMethod(handlerMethod); try { @@ -174,10 +171,8 @@ public final Object invokeHandlerMethod(Method handlerMethod, } @SuppressWarnings("unchecked") - private Object[] resolveHandlerArguments(Method handlerMethod, - Object handler, - NativeWebRequest webRequest, - ExtendedModelMap implicitModel) throws Exception { + private Object[] resolveHandlerArguments(Method handlerMethod, Object handler, + NativeWebRequest webRequest, ExtendedModelMap implicitModel) throws Exception { Class[] paramTypes = handlerMethod.getParameterTypes(); Object[] args = new Object[paramTypes.length]; @@ -340,10 +335,8 @@ protected void initBinder(Object handler, String attrName, WebDataBinder binder, } } - private Object[] resolveInitBinderArguments(Object handler, - Method initBinderMethod, - WebDataBinder binder, - NativeWebRequest webRequest) throws Exception { + private Object[] resolveInitBinderArguments(Object handler, Method initBinderMethod, + WebDataBinder binder, NativeWebRequest webRequest) throws Exception { Class[] initBinderParams = initBinderMethod.getParameterTypes(); Object[] initBinderArgs = new Object[initBinderParams.length]; @@ -410,12 +403,9 @@ else if (pathVarName != null) { } @SuppressWarnings("unchecked") - private Object resolveRequestParam(String paramName, - boolean required, - String defaultValue, - MethodParameter methodParam, - NativeWebRequest webRequest, - Object handlerForInitBinderCall) throws Exception { + private Object resolveRequestParam(String paramName, boolean required, String defaultValue, + MethodParameter methodParam, NativeWebRequest webRequest, Object handlerForInitBinderCall) + throws Exception { Class paramType = methodParam.getParameterType(); if (Map.class.isAssignableFrom(paramType)) { @@ -471,12 +461,9 @@ private Map resolveRequestParamMap(Class mapType, NativeWebReques } @SuppressWarnings("unchecked") - private Object resolveRequestHeader(String headerName, - boolean required, - String defaultValue, - MethodParameter methodParam, - NativeWebRequest webRequest, - Object handlerForInitBinderCall) throws Exception { + private Object resolveRequestHeader(String headerName, boolean required, String defaultValue, + MethodParameter methodParam, NativeWebRequest webRequest, Object handlerForInitBinderCall) + throws Exception { Class paramType = methodParam.getParameterType(); if (Map.class.isAssignableFrom(paramType)) { @@ -532,7 +519,9 @@ private Map resolveRequestHeaderMap(Class mapType, NativeWebReque } } - /** Resolves the given {@link RequestBody @RequestBody} annotation. */ + /** + * Resolves the given {@link RequestBody @RequestBody} annotation. + */ @SuppressWarnings("unchecked") protected Object resolveRequestBody(MethodParameter methodParam, NativeWebRequest webRequest, Object handler) throws Exception { @@ -563,8 +552,8 @@ protected Object resolveRequestBody(MethodParameter methodParam, NativeWebReques } /** - * Return a {@link HttpInputMessage} for the given {@link NativeWebRequest}. Throws an UnsupportedOperationException by - * default. + * Return a {@link HttpInputMessage} for the given {@link NativeWebRequest}. + *

Throws an UnsupportedOperationException by default. */ protected HttpInputMessage createHttpInputMessage(NativeWebRequest webRequest) throws Exception { throw new UnsupportedOperationException("@RequestBody not supported"); @@ -596,7 +585,10 @@ else if (required) { return binder.convertIfNecessary(cookieValue, paramType, methodParam); } - /** Resolves the given {@link CookieValue @CookieValue} annotation. Throws an UnsupportedOperationException by default. */ + /** + * Resolves the given {@link CookieValue @CookieValue} annotation. + *

Throws an UnsupportedOperationException by default. + */ protected Object resolveCookieValue(String cookieName, Class paramType, NativeWebRequest webRequest) throws Exception { @@ -619,8 +611,8 @@ private Object resolvePathVariable(String pathVarName, } /** - * Resolves the given {@link PathVariable @PathVariable} annotation. Throws an UnsupportedOperationException by - * default. + * Resolves the given {@link PathVariable @PathVariable} annotation. + *

Throws an UnsupportedOperationException by default. */ protected String resolvePathVariable(String pathVarName, Class paramType, NativeWebRequest webRequest) throws Exception { @@ -652,11 +644,8 @@ else if (paramType.isPrimitive()) { return value; } - private WebRequestDataBinder resolveModelAttribute(String attrName, - MethodParameter methodParam, - ExtendedModelMap implicitModel, - NativeWebRequest webRequest, - Object handler) throws Exception { + private WebRequestDataBinder resolveModelAttribute(String attrName, MethodParameter methodParam, + ExtendedModelMap implicitModel, NativeWebRequest webRequest, Object handler) throws Exception { // Bind request parameter onto object... String name = attrName; @@ -683,10 +672,8 @@ else if (this.methodResolver.isSessionAttribute(name, paramType)) { } @SuppressWarnings("unchecked") - public final void updateModelAttributes(Object handler, - Map mavModel, - ExtendedModelMap implicitModel, - NativeWebRequest webRequest) throws Exception { + public final void updateModelAttributes(Object handler, Map mavModel, + ExtendedModelMap implicitModel, NativeWebRequest webRequest) throws Exception { if (this.methodResolver.hasSessionAttributes() && this.sessionStatus.isComplete()) { for (String attrName : this.methodResolver.getActualSessionAttributeNames()) { @@ -753,9 +740,7 @@ protected void raiseSessionRequiredException(String message) throws Exception { throw new IllegalStateException(message); } - protected void doBind(WebRequestDataBinder binder, - NativeWebRequest webRequest, - boolean validate, + protected void doBind(WebRequestDataBinder binder, NativeWebRequest webRequest, boolean validate, boolean failOnErrors) throws Exception { binder.bind(webRequest); @@ -803,10 +788,8 @@ protected Object resolveStandardArgument(Class parameterType, NativeWebRequest w return WebArgumentResolver.UNRESOLVED; } - protected final void addReturnValueAsModelAttribute(Method handlerMethod, - Class handlerType, - Object returnValue, - ExtendedModelMap implicitModel) { + protected final void addReturnValueAsModelAttribute(Method handlerMethod, Class handlerType, + Object returnValue, ExtendedModelMap implicitModel) { ModelAttribute attr = AnnotationUtils.findAnnotation(handlerMethod, ModelAttribute.class); String attrName = (attr != null ? attr.value() : "");