使用resty GWT使用GET中的字节[]

使用resty GWT使用GET中的字节[],gwt,jax-rs,resty-gwt,Gwt,Jax Rs,Resty Gwt,在我的服务器端,我有以下功能: @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)

在我的服务器端,我有以下功能:

@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);
@GET
@路径(mypath)
@生成(“图像/jpeg”)
public void getImage(@PathParam(“var1Id”)Long var1Id、@PathParam(“var2Id”)Long var2Id、@PathParam(“imageId”)Long imageId、MethodCallback回调);

我的问题是,为了能够使用服务器端发送的byte[],我应该在methodcallback中添加什么?

对我有效的解决方案是创建一个类byteResponse,其中byte[]数组是一个属性。然后这个类现在是服务器端getImage的返回类型,也是gwt端methodeCallback中的类型。

要通过REST请求传输byte[],我认为更好的方法是将byte[]编码为base64,这将增加图像大小。我让这成为最后的解决办法。