Example usage for org.springframework.web.multipart MaxUploadSizeExceededException getMaxUploadSize

List of usage examples for org.springframework.web.multipart MaxUploadSizeExceededException getMaxUploadSize

Introduction

In this page you can find the example usage for org.springframework.web.multipart MaxUploadSizeExceededException getMaxUploadSize.

Prototype

public long getMaxUploadSize() 

Source Link

Document

Return the maximum upload size allowed, or -1 if the size limit isn't known.

Usage

From source file:com.iisigroup.cap.operation.step.CapFileUploadOpStep.java

protected MultipartHttpServletRequest uploadFile(IRequest params) {
    if (params.containsKey("limitSize")) {
        multipartResolver.setMaxUploadSize(params.getParamsAsInteger("limitSize"));
    }//from www.  j av  a  2 s .c o m
    if (params.containsKey("fileEncoding")) {
        multipartResolver.setDefaultEncoding(params.get("fileEncoding"));
    }

    try {
        return multipartResolver.resolveMultipart((HttpServletRequest) params.getServletRequest());
    } catch (MaxUploadSizeExceededException fe) {
        CapMessageException me = new CapMessageException(fileSizeLimitErrorCode, getClass());
        Object[] extra = new Object[] { CapMath.divide(String.valueOf(fe.getMaxUploadSize()), "1048576", 2) };
        me.setMessageKey(fileSizeLimitErrorCode);
        me.setExtraInformation(extra);
        throw me;
    } catch (MultipartException e) {
        throw new CapException(e, getClass());
    }

}