在我的服务器端,我有以下内容:
@ApiOperation(value = "myValue", tags = "{mytag}")
@GET
@Path("mypath")
@Produces("image/jpeg")
public Response getImage(@ApiParam(hidden = true) @HeaderParam("Accept-Language") String acceptLanguage,
@ApiParam(hidden = true) @HeaderParam("accountId") Long accountId,
@PathParam("var1Id") Long var1, @PathParam("imageId") Long documentId,
@PathParam("var2Id") Long var2Id) throws SyncException {
return Response.ok(ImageService.getImage(acceptLanguage, ImageId)).build();
}
getImage返回类型为byte []的地方。
在我的客户端并使用resty GWT,我有以下内容:
@GET
@Path(mypath)
@Produces("image/jpeg")
public void getImage( @PathParam("var1Id") Long var1id, @PathParam("var2Id") Long var2Id , @PathParam("imageId") Long imageId, MethodCallback<T> callback);
我的问题是我应该在MethodeCallback中添加什么才能使用服务器端发送的byte []?
答案 0 :(得分:0)
对我有用的解决方案是创建一个byteResponse类,其中byte []数组是attribute。那么该类现在是serverSide中getImage的返回类型,并且是gwt侧methodeCallback内部的类型。