2016-08-15 5 views
0

ich localhost bin mit: 8080/_ah/api/Explorer google erkunden: Ich erhaltejava Blobstore und Google SPI AppEngine Endpunkt

{ 
"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]" 
    } 
    ] 
} 

mein Google SPI-Code ist:

@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);  
} 

jederzeit Ich versuche, alles auf die HttpServletResponse zu schreiben Ich bekomme diesen Fehler .. Ich habe verloren, warum ich nicht auf die httpServletResponse

Antwort

0

schreiben kann Soooo .. die an Swer ist wirklich "Design" in meinem Fall.

Da ich "REST" mit Google App Engine implementieren ... Ich sollte die HttpResponse nicht ändern, um ein "Bild" zurückzugeben.

so "Serving" ein Bild zurück zu der HttpResponse ist nicht ideal. Ich soll das Bild direkt mit dem Speicher URL für Kunden aussetzen .:

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

Kann nicht sagen, dass ich ‚100%‘, wie diese Antwort, aber von dem, was ich lese ich glaube, das ist richtig.

Verwandte Themen