From ed14ae60e54b7402ba4b8a3b93311ba0a0786f36 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 7 Apr 2016 11:37:34 +0200 Subject: [PATCH] Consistent deprecation of outdated MVC infrastructure classes Issue: SPR-14128 --- .../HandlerMethodInvocationException.java | 2 ++ .../support/HandlerMethodInvoker.java | 2 ++ .../support/HandlerMethodResolver.java | 2 ++ .../AnnotationMethodHandlerAdapter.java | 14 +++++------ .../AnnotationMethodHandlerAdapter.java | 25 +++++++++---------- .../ResponseEntityExceptionHandler.java | 12 +++++---- .../AbstractUrlMethodNameResolver.java | 2 ++ .../InternalPathMethodNameResolver.java | 4 ++- .../mvc/multiaction/MethodNameResolver.java | 2 ++ .../multiaction/MultiActionController.java | 2 ++ .../NoSuchRequestHandlingMethodException.java | 2 ++ .../ParameterMethodNameResolver.java | 2 ++ .../PropertiesMethodNameResolver.java | 2 ++ .../AbstractControllerUrlHandlerMapping.java | 2 ++ .../AnnotationControllerTypePredicate.java | 2 ++ .../ControllerBeanNameHandlerMapping.java | 2 ++ .../ControllerClassNameHandlerMapping.java | 7 +++--- .../mvc/support/ControllerTypePredicate.java | 6 +++-- .../DefaultHandlerExceptionResolver.java | 12 +++++---- 19 files changed, 68 insertions(+), 36 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvocationException.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvocationException.java index 98ad9992b3..52850cd38d 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvocationException.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvocationException.java @@ -26,7 +26,9 @@ import org.springframework.core.NestedRuntimeException; * @author Juergen Hoeller * @since 2.5.6 * @see HandlerMethodInvoker#invokeHandlerMethod + * @deprecated as of 4.3, in favor of the {@code HandlerMethod}-based MVC infrastructure */ +@Deprecated @SuppressWarnings("serial") public class HandlerMethodInvocationException extends NestedRuntimeException { diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java index eb8693338c..9287882baf 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodInvoker.java @@ -94,7 +94,9 @@ import org.springframework.web.multipart.MultipartRequest; * @author Arjen Poutsma * @since 2.5.2 * @see #invokeHandlerMethod + * @deprecated as of 4.3, in favor of the {@code HandlerMethod}-based MVC infrastructure */ +@Deprecated public class HandlerMethodInvoker { private static final String MODEL_KEY_PREFIX_STALE = SessionAttributeStore.class.getName() + ".STALE."; diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java index 9fd25c014f..53d6584e86 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/support/HandlerMethodResolver.java @@ -48,7 +48,9 @@ import org.springframework.web.bind.annotation.SessionAttributes; * @see org.springframework.web.bind.annotation.InitBinder * @see org.springframework.web.bind.annotation.ModelAttribute * @see org.springframework.web.bind.annotation.SessionAttributes + * @deprecated as of 4.3, in favor of the {@code HandlerMethod}-based MVC infrastructure */ +@Deprecated public class HandlerMethodResolver { private final Set handlerMethods = new LinkedHashSet(); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index 6476c54d4c..017bc18aed 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -76,8 +76,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.annotation.support.HandlerMethodInvoker; -import org.springframework.web.bind.annotation.support.HandlerMethodResolver; import org.springframework.web.bind.support.DefaultSessionAttributeStore; import org.springframework.web.bind.support.SessionAttributeStore; import org.springframework.web.bind.support.WebArgumentResolver; @@ -434,9 +432,10 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator /** - * Portlet-specific subclass of {@link HandlerMethodResolver}. + * Portlet-specific subclass of {@code HandlerMethodResolver}. */ - private static class PortletHandlerMethodResolver extends HandlerMethodResolver { + @SuppressWarnings("deprecation") + private static class PortletHandlerMethodResolver extends org.springframework.web.bind.annotation.support.HandlerMethodResolver { private final Map mappings = new HashMap(); @@ -545,11 +544,12 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator /** - * Portlet-specific subclass of {@link HandlerMethodInvoker}. + * Portlet-specific subclass of {@code HandlerMethodInvoker}. */ - private class PortletHandlerMethodInvoker extends HandlerMethodInvoker { + @SuppressWarnings("deprecation") + private class PortletHandlerMethodInvoker extends org.springframework.web.bind.annotation.support.HandlerMethodInvoker { - public PortletHandlerMethodInvoker(HandlerMethodResolver resolver) { + public PortletHandlerMethodInvoker(org.springframework.web.bind.annotation.support.HandlerMethodResolver resolver) { super(resolver, webBindingInitializer, sessionAttributeStore, parameterNameDiscoverer, customArgumentResolvers, null); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index f3cdd873a2..2a26985c13 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -96,8 +96,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.SessionAttributes; -import org.springframework.web.bind.annotation.support.HandlerMethodInvoker; -import org.springframework.web.bind.annotation.support.HandlerMethodResolver; import org.springframework.web.bind.support.DefaultSessionAttributeStore; import org.springframework.web.bind.support.SessionAttributeStore; import org.springframework.web.bind.support.WebArgumentResolver; @@ -110,9 +108,6 @@ import org.springframework.web.servlet.HandlerAdapter; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.View; -import org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver; -import org.springframework.web.servlet.mvc.multiaction.MethodNameResolver; -import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; import org.springframework.web.servlet.support.RequestContextUtils; import org.springframework.web.servlet.support.WebContentGenerator; import org.springframework.web.util.UrlPathHelper; @@ -164,7 +159,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator private PathMatcher pathMatcher = new AntPathMatcher(); - private MethodNameResolver methodNameResolver = new InternalPathMethodNameResolver(); + private org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver = + new org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver(); private WebBindingInitializer webBindingInitializer; @@ -255,7 +251,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator *

Will only kick in when the handler method cannot be resolved uniquely * through the annotation metadata already. */ - public void setMethodNameResolver(MethodNameResolver methodNameResolver) { + public void setMethodNameResolver(org.springframework.web.servlet.mvc.multiaction.MethodNameResolver methodNameResolver) { this.methodNameResolver = methodNameResolver; } @@ -524,9 +520,10 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator /** - * Servlet-specific subclass of {@link HandlerMethodResolver}. + * Servlet-specific subclass of {@code HandlerMethodResolver}. */ - private class ServletHandlerMethodResolver extends HandlerMethodResolver { + @SuppressWarnings("deprecation") + private class ServletHandlerMethodResolver extends org.springframework.web.bind.annotation.support.HandlerMethodResolver { private final Map mappings = new HashMap(); @@ -674,7 +671,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator if (!allowedMethods.isEmpty()) { throw new HttpRequestMethodNotSupportedException(request.getMethod(), StringUtils.toStringArray(allowedMethods)); } - throw new NoSuchRequestHandlingMethodException(lookupPath, request.getMethod(), request.getParameterMap()); + throw new org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException( + lookupPath, request.getMethod(), request.getParameterMap()); } } @@ -768,13 +766,14 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator /** - * Servlet-specific subclass of {@link HandlerMethodInvoker}. + * Servlet-specific subclass of {@code HandlerMethodInvoker}. */ - private class ServletHandlerMethodInvoker extends HandlerMethodInvoker { + @SuppressWarnings("deprecation") + private class ServletHandlerMethodInvoker extends org.springframework.web.bind.annotation.support.HandlerMethodInvoker { private boolean responseArgumentUsed = false; - private ServletHandlerMethodInvoker(HandlerMethodResolver resolver) { + private ServletHandlerMethodInvoker(org.springframework.web.bind.annotation.support.HandlerMethodResolver resolver) { super(resolver, webBindingInitializer, sessionAttributeStore, parameterNameDiscoverer, customArgumentResolvers, messageConverters); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java index 0be4cb9bc2..267f195997 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java @@ -46,7 +46,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.multipart.support.MissingServletRequestPartException; import org.springframework.web.servlet.NoHandlerFoundException; -import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; import org.springframework.web.util.WebUtils; /** @@ -99,8 +98,9 @@ public abstract class ResponseEntityExceptionHandler { * @param ex the target exception * @param request the current request */ + @SuppressWarnings("deprecation") @ExceptionHandler({ - NoSuchRequestHandlingMethodException.class, + org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException.class, HttpRequestMethodNotSupportedException.class, HttpMediaTypeNotSupportedException.class, HttpMediaTypeNotAcceptableException.class, @@ -118,9 +118,9 @@ public abstract class ResponseEntityExceptionHandler { }) public final ResponseEntity handleException(Exception ex, WebRequest request) { HttpHeaders headers = new HttpHeaders(); - if (ex instanceof NoSuchRequestHandlingMethodException) { + if (ex instanceof org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException) { HttpStatus status = HttpStatus.NOT_FOUND; - return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException) ex, headers, status, request); + return handleNoSuchRequestHandlingMethod((org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException) ex, headers, status, request); } else if (ex instanceof HttpRequestMethodNotSupportedException) { HttpStatus status = HttpStatus.METHOD_NOT_ALLOWED; @@ -213,8 +213,10 @@ public abstract class ResponseEntityExceptionHandler { * @param status the selected response status * @param request the current request * @return a {@code ResponseEntity} instance + * @deprecated as of 4.3, along with {@link org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException} */ - protected ResponseEntity handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, + @Deprecated + protected ResponseEntity handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { pageNotFoundLogger.warn(ex.getMessage()); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java index 3ee748d461..0cc4fd1d9e 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/AbstractUrlMethodNameResolver.java @@ -34,7 +34,9 @@ import org.springframework.web.util.UrlPathHelper; * * @author Juergen Hoeller * @since 14.01.2004 + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public abstract class AbstractUrlMethodNameResolver implements MethodNameResolver { /** Logger available to subclasses */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/InternalPathMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/InternalPathMethodNameResolver.java index f81e806b07..18b340ee16 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/InternalPathMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/InternalPathMethodNameResolver.java @@ -35,7 +35,9 @@ import org.springframework.web.util.WebUtils; * * @author Rod Johnson * @author Juergen Hoeller -*/ + * @deprecated as of 4.3, in favor of annotation-driven handler methods + */ +@Deprecated public class InternalPathMethodNameResolver extends AbstractUrlMethodNameResolver { private String prefix = ""; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java index d67f3019f8..8d4751f8b0 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MethodNameResolver.java @@ -28,7 +28,9 @@ import javax.servlet.http.HttpServletRequest; * * @author Rod Johnson * @see MultiActionController#setMethodNameResolver + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public interface MethodNameResolver { /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java index 188c966716..6ef9b7bfec 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/MultiActionController.java @@ -127,7 +127,9 @@ import org.springframework.web.servlet.mvc.LastModified; * @see ParameterMethodNameResolver * @see org.springframework.web.servlet.mvc.LastModified#getLastModified * @see org.springframework.web.bind.ServletRequestDataBinder + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public class MultiActionController extends AbstractController implements LastModified { /** Suffix for last-modified methods */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java index 1038c80082..7d7d547fcf 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/NoSuchRequestHandlingMethodException.java @@ -30,7 +30,9 @@ import org.springframework.web.util.UrlPathHelper; * @author Rod Johnson * @author Juergen Hoeller * @see MethodNameResolver#getHandlerMethodName(javax.servlet.http.HttpServletRequest) + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated @SuppressWarnings("serial") public class NoSuchRequestHandlingMethodException extends ServletException { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java index ff1b45470e..55971724ea 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java @@ -79,7 +79,9 @@ import org.springframework.web.util.WebUtils; * @see #setMethodParamNames * @see #setLogicalMappings * @see #setDefaultMethodName + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public class ParameterMethodNameResolver implements MethodNameResolver { /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java index 0f458a9e41..8bc14b060b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/PropertiesMethodNameResolver.java @@ -45,7 +45,9 @@ import org.springframework.util.PathMatcher; * @author Juergen Hoeller * @see java.util.Properties * @see org.springframework.util.AntPathMatcher + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public class PropertiesMethodNameResolver extends AbstractUrlMethodNameResolver implements InitializingBean { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java index 7893bc5954..5604ed327a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java @@ -31,7 +31,9 @@ import org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMappin * @since 2.5.3 * @see ControllerClassNameHandlerMapping * @see ControllerBeanNameHandlerMapping + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetectingUrlHandlerMapping { private ControllerTypePredicate predicate = new AnnotationControllerTypePredicate(); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java index ef0d574d86..d9c3cfae04 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AnnotationControllerTypePredicate.java @@ -25,7 +25,9 @@ import org.springframework.stereotype.Controller; * * @author Juergen Hoeller * @since 2.5.3 + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated class AnnotationControllerTypePredicate extends ControllerTypePredicate { @Override diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java index dc88ef3287..90fa215912 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerBeanNameHandlerMapping.java @@ -37,7 +37,9 @@ import org.springframework.util.StringUtils; * @since 2.5.3 * @see ControllerClassNameHandlerMapping * @see org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public class ControllerBeanNameHandlerMapping extends AbstractControllerUrlHandlerMapping { private String urlPrefix = ""; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java index 752554cc5c..b47545dd4f 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerClassNameHandlerMapping.java @@ -18,7 +18,6 @@ package org.springframework.web.servlet.mvc.support; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; -import org.springframework.web.servlet.mvc.multiaction.MultiActionController; /** * Implementation of {@link org.springframework.web.servlet.HandlerMapping} that @@ -36,7 +35,7 @@ import org.springframework.web.servlet.mvc.multiaction.MultiActionController; *
  • {@code HomeController} -> {@code /home*}
  • * * - *

    For {@link MultiActionController MultiActionControllers} and {@code @Controller} + *

    For {@code MultiActionController MultiActionControllers} and {@code @Controller} * beans, a similar mapping is registered, except that all sub-paths are registered * using the trailing wildcard pattern {@code /*}. For example: *

      @@ -44,7 +43,7 @@ import org.springframework.web.servlet.mvc.multiaction.MultiActionController; *
    • {@code CatalogController} -> {@code /catalog}, {@code /catalog/*}
    • *
    * - *

    For {@link MultiActionController} it is often useful to use + *

    For {@code MultiActionController} it is often useful to use * this mapping strategy in conjunction with the * {@link org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver}. * @@ -56,7 +55,9 @@ import org.springframework.web.servlet.mvc.multiaction.MultiActionController; * @since 2.0 * @see org.springframework.web.servlet.mvc.Controller * @see org.springframework.web.servlet.mvc.multiaction.MultiActionController + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated public class ControllerClassNameHandlerMapping extends AbstractControllerUrlHandlerMapping { /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java index 33571f467b..20f690d4f2 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/ControllerTypePredicate.java @@ -17,22 +17,24 @@ package org.springframework.web.servlet.mvc.support; import org.springframework.web.servlet.mvc.Controller; -import org.springframework.web.servlet.mvc.multiaction.MultiActionController; /** * Internal helper class that identifies controller types. * * @author Juergen Hoeller * @since 2.5.3 + * @deprecated as of 4.3, in favor of annotation-driven handler methods */ +@Deprecated class ControllerTypePredicate { public boolean isControllerType(Class beanClass) { return Controller.class.isAssignableFrom(beanClass); } + @SuppressWarnings("deprecation") public boolean isMultiActionControllerType(Class beanClass) { - return MultiActionController.class.isAssignableFrom(beanClass); + return org.springframework.web.servlet.mvc.multiaction.MultiActionController.class.isAssignableFrom(beanClass); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java index 77290e5681..6dea3daaa7 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java @@ -49,7 +49,6 @@ import org.springframework.web.multipart.support.MissingServletRequestPartExcept import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.NoHandlerFoundException; import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver; -import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; /** * Default implementation of the {@link org.springframework.web.servlet.HandlerExceptionResolver @@ -101,13 +100,14 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes @Override + @SuppressWarnings("deprecation") protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { try { - if (ex instanceof NoSuchRequestHandlingMethodException) { - return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException) ex, request, response, - handler); + if (ex instanceof org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException) { + return handleNoSuchRequestHandlingMethod((org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException) ex, + request, response, handler); } else if (ex instanceof HttpRequestMethodNotSupportedException) { return handleHttpRequestMethodNotSupported((HttpRequestMethodNotSupportedException) ex, request, @@ -180,8 +180,10 @@ public class DefaultHandlerExceptionResolver extends AbstractHandlerExceptionRes * at the time of the exception (for example, if multipart resolution failed) * @return an empty ModelAndView indicating the exception was handled * @throws IOException potentially thrown from response.sendError() + * @deprecated as of 4.3, along with {@link org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException} */ - protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, + @Deprecated + protected ModelAndView handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException ex, HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { pageNotFoundLogger.warn(ex.getMessage());