title: How to handle SizeLimitExceededException from CommonsMultipartResolver in Spring WebFlow?
body: <p>I have the following situation. I have a CommonsMultipartResolver bean configured the following way.</p>
  
  <pre><code>&lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt;
  &lt;property name="maxUploadSize" value="2100000" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>And I have a few file upload fields in a Spring Web Flow view state jsp.</p>
  
  <p>Everything works fine if the file is under the limit, but if the file exceeds the limit of 2MB-s I have to add a validation error to the binding result on my form.</p>
  
  <p>My problem is that the multipart file resolver throws a org.apache.commons.fileupload.FileUploadBase.SizeL imitExceededException exception when the file limit is exceeded and I can't find a way to catch this in Spring Web Flow and add my FieldError to the form.</p>
  
  <p>I tried using the on-exception attribute of the transition tag, but if I understand correctly it only works for exceptions that are thrown within Spring Web Flow.</p>
  
  <p>I've also tried to use SimpleMappingExceptionResolver in spring mvc, but I do not want to redirect to a page, I want to handle this exception.</p>
  
  <p>I also found this: <a href="https://jira.springsource.org/browse/SWF-158" rel="noreferrer">https://jira.springsource.org/browse/SWF-158</a></p>
  
  <p>But it's from version 1.0 and I'm assuming that this has been incorporated since or that a better way was found to handle these situations.</p>
  
  <p>Any ideas on how to deal with this would be greatly appreciated.</p>
  
  <p>Thanks.</p>