diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java index 213a2868986..1f30a41c760 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter.java @@ -114,23 +114,26 @@ import org.springframework.web.util.UrlPathHelper; import org.springframework.web.util.WebUtils; /** - * Implementation of the {@link org.springframework.web.servlet.HandlerAdapter} interface that maps handler methods - * based on HTTP paths, HTTP methods and request parameters expressed through the {@link RequestMapping} annotation. + * Implementation of the {@link org.springframework.web.servlet.HandlerAdapter} interface + * that maps handler methods based on HTTP paths, HTTP methods and request parameters + * expressed through the {@link RequestMapping} annotation. * - *

Supports request parameter binding through the {@link RequestParam} annotation. Also supports the {@link - * ModelAttribute} annotation for exposing model attribute values to the view, as well as {@link InitBinder} for binder - * initialization methods and {@link SessionAttributes} for automatic session management of specific attributes. + *

Supports request parameter binding through the {@link RequestParam} annotation. + * Also supports the {@link ModelAttribute} annotation for exposing model attribute + * values to the view, as well as {@link InitBinder} for binder initialization methods + * and {@link SessionAttributes} for automatic session management of specific attributes. * - *

This adapter can be customized through various bean properties. A common use case is to apply shared binder - * initialization logic through a custom {@link #setWebBindingInitializer WebBindingInitializer}. + *

This adapter can be customized through various bean properties. + * A common use case is to apply shared binder initialization logic through + * a custom {@link #setWebBindingInitializer WebBindingInitializer}. * * @author Juergen Hoeller * @author Arjen Poutsma + * @since 2.5 * @see #setPathMatcher * @see #setMethodNameResolver * @see #setWebBindingInitializer * @see #setSessionAttributeStore - * @since 2.5 */ public class AnnotationMethodHandlerAdapter extends WebContentGenerator implements HandlerAdapter, Ordered, BeanFactoryAware { @@ -451,9 +454,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator * @see ServletRequestDataBinder#bind(javax.servlet.ServletRequest) * @see ServletRequestDataBinder#convertIfNecessary(Object, Class, org.springframework.core.MethodParameter) */ - protected ServletRequestDataBinder createBinder( - HttpServletRequest request, Object target, String objectName) throws Exception { - + protected ServletRequestDataBinder createBinder(HttpServletRequest request, Object target, String objectName) + throws Exception { return new ServletRequestDataBinder(target, objectName); } @@ -466,7 +468,6 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator * @throws Exception in case of errors */ protected HttpInputMessage createHttpInputMessage(HttpServletRequest servletRequest) throws Exception { - return new ServletServerHttpRequest(servletRequest); } @@ -479,7 +480,6 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator * @throws Exception in case of errors */ protected HttpOutputMessage createHttpOutputMessage(HttpServletResponse servletResponse) throws Exception { - return new ServletServerHttpResponse(servletResponse); } @@ -833,12 +833,11 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator handleResponseBody(returnValue, webRequest); return null; } - if (returnValue instanceof HttpEntity) { + else if (returnValue instanceof HttpEntity) { handleHttpEntityResponse((HttpEntity) returnValue, webRequest); return null; } - - if (returnValue instanceof ModelAndView) { + else if (returnValue instanceof ModelAndView) { ModelAndView mav = (ModelAndView) returnValue; mav.getModelMap().mergeAttributes(implicitModel); return mav; @@ -884,10 +883,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator if (returnValue == null) { return; } - HttpInputMessage inputMessage = createHttpInputMessage(webRequest); HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest); - writeWithMessageConverters(returnValue, inputMessage, outputMessage); } @@ -898,7 +895,6 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator } HttpInputMessage inputMessage = createHttpInputMessage(webRequest); HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest); - HttpHeaders entityHeaders = responseEntity.getHeaders(); if (!entityHeaders.isEmpty()) { outputMessage.getHeaders().putAll(entityHeaders); @@ -1086,7 +1082,6 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator } return Collections.emptyList(); } - - } + } diff --git a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java index 1f274735113..fe7fac62cd4 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java +++ b/org.springframework.web/src/main/java/org/springframework/web/bind/annotation/ResponseBody.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -23,13 +23,13 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Annotation which indicates that a method return value should be bound to the web response body. Supported for annotated - * handler methods in Servlet environments. + * Annotation which indicates that a method return value should be bound to the web response body. + * Supported for annotated handler methods in Servlet environments. * * @author Arjen Poutsma + * @since 3.0 * @see RequestBody * @see org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter - * @since 3.0 */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME)