SPR-6709 Handle RequestBodyNotValidException and update reference docs

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4423 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Rossen Stoyanchev
2011-06-02 18:27:50 +00:00
parent 153b3fd101
commit 5d69429178
4 changed files with 44 additions and 4 deletions
+10 -1
View File
@@ -1369,9 +1369,18 @@ public void handle(@RequestBody String body, Writer writer) throws IOException {
<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/>
</programlisting>
<para>An <classname>@RequestBody</classname> method parameter can be annotated with
<classname>@Valid</classname>, in which case it will validated using the configured
<classname>Validator</classname> instance. When using the MVC namespace a JSR-303
validator is configured automatically assuming a JSR-303 implementation is available
on the classpath. If validation fails a <classname>RequestBodyNotValidException</classname>
is raised. The exception is handled by the <classname>DefaultHandlerExceptionResolver</classname>
and results in a <literal>500</literal> error send back to the client along with
a message containing the validation errors.</para>
<note>
<para> Also see <xref linkend="mvc-annotation-driven"/> for information on
configuring message converters through the MVC namespace.</para>
configuring message converters and a validator through the MVC namespace.</para>
</note>
</section>