GWT - 图片上传和GAE [英] GWT - image upload and GAE

查看:140
本文介绍了GWT - 图片上传和GAE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我观看了服务器端上传代码示例 ...它说下... ...

I've watched the server-side upload code example... it says next...

...
 /**
   * 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);
   }
  }
...

...确定,正如我所看到的,要获取文件片段使用文件对象。但是,我记得,GAE不支持File io对象。所以我的问题是这个库确定为GAE文件上传或有一些更优化的GWT库?

... OK, as I can see, to get file the snippet uses File object. But, as I can remember, GAE does not support the File io object. So my question is this lib OK as for GAE file upload or there is some more optimal library for GWT?

谢谢

Thanks

推荐答案

GAE中不需要使用Java IO来处理图片上传,您可以依靠 Blobstore ImageService API。 本教程有一个很好的解释和例子,我遵循它,我的上传功能运行顺利。

There's no need to use Java IO to handle Image Upload in GAE, you can just rely on Blobstore and ImageService APIs. This tutorial has a nice explanation and an example, I followed it and my upload functionality works smoothly.

这篇关于GWT - 图片上传和GAE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆