views:

15

answers:

0

I've configured a MultipartResolver in my Spring MVC webapp and set its maxUploadSize property to 1MB.

<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize">
        <!-- 1MB max -->
        <value>1048576</value>
    </property>
</bean>

When a user sends a HTTP POST request with a file bigger than maxUploadSize, the expected MaxUploadSizeExceededException is thrown and catched in my HandlerExceptionResolver - but it seems like the browsers POSTs the whole file before displaying the error view (rendered by the HandlerExceptionResolver).

How can I interrupt this POST request? Users shouldn't wait the whole file to be sent, then be shown an error...