diff --git a/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd b/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd
index 63abaae351..bb6190f11a 100644
--- a/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd
+++ b/spring-integration-http/src/main/resources/org/springframework/integration/http/config/spring-integration-http-2.2.xsd
@@ -67,6 +67,22 @@
View name to be resolved when rendering a response.
+ This attribute is not allowed if there is a 'view-expression' attribute.
+
+
+
+
+
+
+ SpEL expression that resolves to a view to be resolved when rendering a response.
+ The expression can resolve to a view name or View object.
+ However, because there is no reply message, the
+ 'evaluationContext' for this expression is rather lightweight; it has a
+ 'BeanResolver' but no variables,
+ so the usage of this attribute is somewhat limited.
+ An example might be to resolve, at runtime, some scoped Bean that returns a
+ view name or View object.
+ This attribute is not allowed if there is a 'view-name' attribute.
@@ -199,6 +215,7 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re
View name to be resolved when rendering a response.
+ This attribute is not allowed if there is a 'view-expression' attribute.
@@ -208,6 +225,7 @@ The String "HTTP_REQUEST_HEADERS" will match against any of the standard HTTP Re
SpEL expression that resolves to a view to be resolved when rendering a response.
The expression can resolve to a view name or View object.
The root object of the evaluation context is the reply message.
+ This attribute is not allowed if there is a 'view-name' attribute.
diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests-context.xml b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests-context.xml
index 5ffa7f9453..546fdbb6e2 100644
--- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests-context.xml
+++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests-context.xml
@@ -23,27 +23,29 @@
-
+
+
+
-
-
-
-
-
-
diff --git a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java
index 1626d990e3..785ac66445 100644
--- a/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java
+++ b/spring-integration-http/src/test/java/org/springframework/integration/http/config/HttpInboundChannelAdapterParserTests.java
@@ -36,6 +36,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.expression.Expression;
import org.springframework.expression.spel.SpelEvaluationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -58,6 +59,7 @@ import org.springframework.util.MultiValueMap;
* @author Oleg Zhurakousky
* @author Gary Russell
* @author Gunnar Hillert
+ * @author Artem Bilan
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@@ -92,6 +94,9 @@ public class HttpInboundChannelAdapterParserTests {
@Autowired
private HttpRequestHandlingController inboundController;
+ @Autowired
+ private HttpRequestHandlingController inboundControllerViewExp;
+
@Autowired
private MessageChannel autoChannel;
@@ -268,9 +273,16 @@ public class HttpInboundChannelAdapterParserTests {
@Test
public void testController() throws Exception {
- DirectFieldAccessor accessor = new DirectFieldAccessor(inboundController);
- String errorCode = (String) accessor.getPropertyValue("errorCode");
+ String errorCode = TestUtils.getPropertyValue(inboundController, "errorCode", String.class);
assertEquals("oops", errorCode);
+ Expression viewExpression = TestUtils.getPropertyValue(inboundController, "viewExpression", Expression.class);
+ assertEquals("foo", viewExpression.getExpressionString());
+ }
+
+ @Test
+ public void testInt2717ControllerWithViewExpression() throws Exception {
+ Expression viewExpression = TestUtils.getPropertyValue(inboundControllerViewExp, "viewExpression", Expression.class);
+ assertEquals("'foo'", viewExpression.getExpressionString());
}
@Test