Hi,
Thanks for your question. Depending on your specific use-case, there are a few options available that may work as an immediate solution. The first option is not ideal, but you could implement your own custom view and render a different response depending on the success/error state from within that single view. For example you could do something like this:
Code:
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<bean name="myView" class="org.springframework.integration.samples.http.MyCustomView"/>
Then, you can use "myView" as your view name in the HTTP Inbound Gateway and within the view implementation itself you have access to the message payload (as part of the model) as well as any exceptions.
Another option would be to use Spring MVC directly as your entry point and then interact with Spring Integration from within your Spring MVC Controller using e.g. a Gateway Proxy.
Likewise, it's possible to just let an Exception propagate and then have the Spring MVC exception-mappings resolve the respective error view (without any MVC controllers involved, and no view-name attribute specified on your Spring Integration HTTP Inbound Gateway). For example:
Code:
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<map>
<entry key="org.springframework.integration.samples.http.FooException" value="errorView"/>
</map>
</property>
</bean>
Lastly, I concede there might be the need improve the HTTP Inbound Gateway itself and provide support for an attribute "view-name-expression" that would allow you to retrieve the view name dynamically using SpEL Expressions.
Another option would be to add support for an "error view". If this might be useful to you, please feel free to open a Jira ticket.
I hope this gives you some options. Also, please let us know if you have other ideas, as depending on your use-case you may have specific requirements.
Thanks!
Cheers,
Gunnar