java BlobStore 和 Google SPI AppEngine 端点

java BlobStore and Google SPI AppEngine endpoint

我正在使用 localhost:8080/_ah/api/explorer google 探索: 我不断收到

{
 "error": {
  "message": "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of javax.servlet.http.HttpServletResponse, problem: abstract types can only be instantiated with additional type information\n at [Source: N/A; line: -1, column: -1]",
  "code": 400,
  "errors": [
   {
    "domain": "global",
    "reason": "badRequest",
    "message": "com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not construct instance of javax.servlet.http.HttpServletResponse, problem: abstract types can only be instantiated with additional type information\n at [Source: N/A; line: -1, column: -1]"
   }
  ]
 }

我的 Google SPI 代码是:

    @ApiMethod(name = "findBillImage", httpMethod = ApiMethod.HttpMethod.GET )
public void findImage(HttpServletResponse httpServletResponse ,  @Named("blobkey") String blobKeyValue)   throws IOException {
     BlobKey blobKey = new BlobKey( blobKeyValue );
     BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();          
     blobstoreService.serve(blobKey, httpServletResponse);       
}

每当我尝试向 HttpServletResponse 写入任何内容时,我都会收到此错误。我不知道为什么我无法写入 httpServletResponse

太棒了.. 就我而言,答案确实是 'design'。

由于我使用 google 应用程序引擎实施 "REST"...我不应将 HttpResponse 修改为 return 和 "image"。

所以 "serving" 返回给 HttpResponse 的图像并不理想。 我应该直接将带有存储 URL 的图像公开给客户。:

https://storage.cloud.google.com/myapp.appspot.com/20160603_154924.jpg

不能说我“100%”喜欢这个答案,但根据我正在阅读的内容,我相信这是正确的。