GWT 2.5.0DevMode
file upload
我在下面做了一个简单的测试,
启动网址:http://127.0.0.1:8888/UploadTest.html?gwt.codesvr=127.0.0.1:9997
<g:FormPanel ui:field="fpUpload">
<g:VerticalPanel>
<g:FileUpload name="fileData" ui:field="fuUpload" />
<g:Button ui:field="btUpload">Upload</g:Button>
</g:VerticalPanel>
</g:FormPanel>
@UiHandler("btUpload")
public void onClickUploadButton(ClickEvent e) {
System.out.println("fileName:" + fuUpload.getFilename());
fpUpload.setEncoding(FormPanel.ENCODING_MULTIPART);
fpUpload.setMethod(FormPanel.METHOD_POST);
fpUpload.setAction("/files");
fpUpload.submit();
System.out.println("Submitted, please wait!");
}
@UiHandler("fpUpload")
public void onSubmitComplete(SubmitCompleteEvent event) {
System.out.println("Submit completed!");
}
输出:
fileName:C:\fakepath\one_file_chosen_to_upload
Submitted, please wait!
但是,服务器没有收到submit request
,所以“提交完成!” 从未出现。
同时,下面的流量被窥探,submit request
根本没有发出。
$ tcpdump -A -i lo port 8888
也没有抛出异常。任何想法?
@编辑
该问题可在ProdMode
.
@编辑 2
仅重新启动机器后,现在问题似乎消失了,就像http submit request
被忽略通过电线发射一样。不幸的是,我不知道为什么。