在我的服务器端我有以下内容:
@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 []?
对我有用的解决方案是创建一个byteResponse类,其中byte []数组是一个属性。那么这个类现在是serverSide中getImage的返回类型,以及gwt端的methodeCallback内部的类型。