diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/bind/annotation/RenderMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/bind/annotation/RenderMapping.java index 13e8d31095..f11cb2d146 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/bind/annotation/RenderMapping.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/bind/annotation/RenderMapping.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2015 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. @@ -22,12 +22,14 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.springframework.core.annotation.AliasFor; import org.springframework.web.bind.annotation.Mapping; /** * Annotation for mapping Portlet render requests onto handler methods. * * @author Juergen Hoeller + * @author Sam Brannen * @since 3.0 * @see org.springframework.web.bind.annotation.RequestMapping */ @@ -37,23 +39,33 @@ import org.springframework.web.bind.annotation.Mapping; @Mapping public @interface RenderMapping { + /** + * Alias for {@link #windowState}. + */ + @AliasFor(attribute = "windowState") + String value() default ""; + /** * The window state that the annotated render method applies for. *
If not specified, the render method will be invoked for any * window state within its general mapping. - *
Standard Portlet spec values: "NORMAL", "MAXIMIZED", "MINIMIZED". - * Custom window states can be used as well, as supported by the portal. + *
Standard Portlet specification values are supported: {@code "NORMAL"}, + * {@code "MAXIMIZED"}, {@code "MINIMIZED"}. + *
Custom window states can be used as well, as supported by the portal. + * @since 4.2 + * @see #value * @see javax.portlet.PortletRequest#getWindowState() */ - String value() default ""; + @AliasFor(attribute = "value") + String windowState() default ""; /** * The parameters of the mapped request, narrowing the primary mapping. - *
Same format for any environment: a sequence of "myParam=myValue" style - * expressions, with a request only mapped if each such parameter is found - * to have the given value. "myParam" style expressions are also supported, + *
Same format for any environment: a sequence of {@code "myParam=myValue"} + * style expressions, with a request only mapped if each such parameter is found + * to have the given value. {@code "myParam"} style expressions are also supported, * with such parameters having to be present in the request (allowed to have - * any value). Finally, "!myParam" style expressions indicate that the + * any value). Finally, {@code "!myParam"} style expressions indicate that the * specified parameter is not supposed to be present in the request. * @see org.springframework.web.bind.annotation.RequestMapping#params() */ 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 8602982898..6476c54d4c 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 @@ -459,7 +459,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator mappingInfo.initPhaseMapping(PortletRequest.ACTION_PHASE, actionMapping.name(), actionMapping.params()); } if (renderMapping != null) { - mappingInfo.initPhaseMapping(PortletRequest.RENDER_PHASE, renderMapping.value(), renderMapping.params()); + mappingInfo.initPhaseMapping(PortletRequest.RENDER_PHASE, renderMapping.windowState(), renderMapping.params()); } if (resourceMapping != null) { mappingInfo.initPhaseMapping(PortletRequest.RESOURCE_PHASE, resourceMapping.value(), new String[0]); diff --git a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java index c5c6186944..ef792dd036 100644 --- a/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java +++ b/spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/mvc/annotation/DefaultAnnotationHandlerMapping.java @@ -167,7 +167,7 @@ public class DefaultAnnotationHandlerMapping extends AbstractMapBasedHandlerMapp } else if (renderMapping != null) { params = StringUtils.mergeStringArrays(params, renderMapping.params()); - predicate = new RenderMappingPredicate(renderMapping.value(), params); + predicate = new RenderMappingPredicate(renderMapping.windowState(), params); } else if (resourceMapping != null) { predicate = new ResourceMappingPredicate(resourceMapping.value()); diff --git a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java index b0c8d351bb..f692946c06 100644 --- a/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java +++ b/spring-webmvc-portlet/src/test/java/org/springframework/web/portlet/mvc/annotation/Portlet20AnnotationControllerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -1260,7 +1260,7 @@ public class Portlet20AnnotationControllerTests { } - @RequestMapping(value="view") + @RequestMapping("view") public static class FirstController { @RenderMapping @@ -1277,7 +1277,7 @@ public class Portlet20AnnotationControllerTests { } - @RequestMapping(value="view") + @RequestMapping("view") public static class SecondController { @ResourceMapping("second") @@ -1286,7 +1286,7 @@ public class Portlet20AnnotationControllerTests { return "resourceSecond"; } - @RenderMapping(value = "MAXIMIZED", params = "report=second") + @RenderMapping(windowState = "MAXIMIZED", params = "report=second") public String renderSecond(RenderResponse response) { response.setProperty("RESPONSE", "renderSecond"); return "renderSecond"; @@ -1294,7 +1294,7 @@ public class Portlet20AnnotationControllerTests { } - @RequestMapping(value="view") + @RequestMapping("view") public static class ThirdController { @ResourceMapping("third") @@ -1303,7 +1303,7 @@ public class Portlet20AnnotationControllerTests { return "resourceThird"; } - @RenderMapping(value = "MAXIMIZED", params = "report=third") + @RenderMapping(windowState = "MAXIMIZED", params = "report=third") public String renderSecond(RenderResponse response) { response.setProperty("RESPONSE", "renderThird"); return "renderThird";