我使用的是localhost:8080 / _ah / api / explorer google explore: 我一直在
{
"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
答案 0 :(得分:0)
SOOOO .. 答案真的是设计'就我而言。
因为我是实施" REST"使用谷歌应用引擎......我不应该修改HttpResponse来返回"图像"。
所以"服务"回到HttpResponse的图像并不理想。 我应该直接用存储URL将图像暴露给客户端。:
https://storage.cloud.google.com/myapp.appspot.com/20160603_154924.jpg
不能说我100%'喜欢这个答案,但从我正在阅读的内容来看,我认为这是正确的。