<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=mark.pollack" rel="nofollow">Mark Pollack</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-7793?redirect=false" rel="nofollow">SPR-7793</a></strong> and commented</p>
<p dir="auto">Other MVC framework such as Ruby on Rails and ASP.NET MVC support interception after parameter binding has occured.  Spring MVC should support this extension point.  The use case driving this are storing of MVC event analytics data in NoSQL databases such as MongoDB.  The current filter support in MVC is before binding has taken place and therefore harder to access information that will be converted to objects at the time of controller invocation.</p>
<p dir="auto">See <a href="https://github.com/SpringSource/spring-data-document/tree/master/spring-data-document-core/src/main/java/org/springframework/data/document/web/servlet">https://github.com/SpringSource/spring-data-document/tree/master/spring-data-document-core/src/main/java/org/springframework/data/document/web/servlet</a></p>
<p dir="auto">for an example implementation.</p>
<p dir="auto">These are called 'action filters' in Ruby on Rails/ASP.NET MVC</p>
<p dir="auto"><a href="http://guides.rubyonrails.org/action_controller_overview.html" rel="nofollow">http://guides.rubyonrails.org/action_controller_overview.html</a></p>
<p dir="auto"><a href="http://www.asp.net/mvc/tutorials/understanding-action-filters-cs" rel="nofollow">http://www.asp.net/mvc/tutorials/understanding-action-filters-cs</a></p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 GA</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398099854" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11103" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11103/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11103">#11103</a> <code class="notranslate">@MVC</code> should provide an "onBind" hook prior to automatic validation (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sbrannen" rel="nofollow">Sam Brannen</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6437?redirect=false" rel="nofollow">SPR-6437</a></strong> and commented</p>
<p dir="auto">When using <code class="notranslate">@Valid</code> to drive automatic validation of a model object, it is currently not possible to modify the bound model object prior to validation.</p>
<p dir="auto">With the SimpleFormController hierarchy it was straightforward to override BaseCommandController's onBind() or onBindAndValidate() methods to achieve custom binding; however, with <code class="notranslate">@MVC</code> it is currently not possible. Neither the WebBindingInitializer API nor an <code class="notranslate">@InitBinder</code> method provides a mechanism to plug in custom binding.</p>
<p dir="auto">Note that this was not an issue prior to support for <code class="notranslate">@Valid</code>, since without <code class="notranslate">@Valid</code> developers were responsible for executing validation code within a handler method.</p>
<p dir="auto">One possible solution would be to add support for an <code class="notranslate">@PostBinding</code> method or <code class="notranslate">@PreValidation</code> method (or similar) which would be allowed to modify the model after binding but prior to executing the handler method.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 RC2</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398109039" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12449" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12449/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12449">#12449</a> Support for interception of controller method invocation after binding has completed (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398092800" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10091" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10091/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10091">#10091</a> Integrating validation into the <code class="notranslate">@MVC</code> request lifecycle</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398100127" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11138" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11138/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11138">#11138</a> <code class="notranslate">@MVC</code> should provide a way to invoke custom code at preBind stage</li>
</ul>
<p dir="auto">6 votes, 6 watchers</p>