如何在GWT中的MultiUploader中覆盖错误消息

时间:2015-03-04 16:52:50

标签: gwt upload

我正在使用GWT MultiUploader将文件上传到服务器。上传文件的最大大小应为10MB。

 @UiField(provided = true)
 MultiUploader muplDef; 

public MyClass()
        muplDef = new MultiUploader();
        muplDef.setValidExtensions("jpg");
        muplDef.setMaximumFiles(1);
        muplDef.avoidRepeatFiles(false);
        muplDef.addOnFinishUploadHandler(onFinishUploaderHandler);
        muplDef.addOnCancelUploadHandler(onCancelUploaderHander);
...
}

在我的web.xml文件中,我设置了上传文件的最大大小。

<context-param>
        <!-- max size of the upload request -->
        <param-name>maxSize</param-name>
        <param-value>10485760</param-value>
    </context-param>

当我尝试上传zip文件时,我收到错误

Invalid file.
Only these types are allowed:
.jpg

当我尝试上传大于10MB的文件时,我收到错误

The upload was canceled because there was an error in the server.
Server error is:
The request was rejected because its size: 26 190 KB, exceeds the maximum: 10 240 KB

所以我的问题是:如何覆盖此错误消息并将文本更改为我的。感谢。

1 个答案:

答案 0 :(得分:0)

编辑文件的最快方法&#34; gwtupload-1.0.3 \ gwtupload \ server \ UploadServlet.properties&#34;来自gwtupload-1.0.3.jar