java GWT图像上传和GAE
我看了服务器端上传code example。。。上面说接下来
...
/**
* Get the content of an uploaded file.
*/
@Override
public void getUploadedFile(HttpServletRequest request, HttpServletResponse response) throws IOException {
String fieldName = request.getParameter(UConsts.PARAM_SHOW);
File f = receivedFiles.get(fieldName);
if (f != null) {
response.setContentType(receivedContentTypes.get(fieldName));
FileInputStream is = new FileInputStream(f);
copyFromInputStreamToOutputStream(is, response.getOutputStream());
} else {
renderXmlResponse(request, response, XML_ERROR_ITEM_NOT_FOUND);
}
}
...
。。。如我所见,为了获取文件,代码段使用了file对象。但是,正如我所记得的,GAE不支持文件io对象。所以我的问题是,对于GAE文件上传,这个库还可以吗?还是有一些更适合GWT的库
谢谢
# 1 楼答案
在GAE中不需要使用Java IO来处理图像上传,您只需依赖Blobstore和ImageServiceAPI即可This tutorial有一个很好的解释和一个例子,我遵循它,我的上传功能工作顺利