当我想使用AsyncResponse稍后发送回复时,如何访问HTTP POST主体的原始字节?
在下面的代码中,当我取消注释此部分/*, @Context final byte [] rawBytesIn*/
时,出现以下错误:错误[2015-05-20 22:36:18,441] com.sun.jersey.spi.inject.Errors:使用资源和/或提供程序类检测到以下错误和警告:
严重:在索引0处的参数处缺少方法public void com.abc.resources.MyResource.postSearch(javax.ws.rs.container.AsyncResponse,byte [])的依赖项
严重:缺少方法public void com.abc.resources.MyResource.postSearch(javax.ws.rs.container.AsyncResponse,byte [])在索引1处参数的依赖
@Path("/")
public class MyResource
{
@POST
@Consumes("application/fastinfoset")
@Produces("application/fastinfoset")
public void postSearch(@Suspended final AsyncResponse ar/*, @Context final byte [] rawBytesIn*/) {
new Thread(new Runnable() {
@Override
public void run() {
byte [] rawBytesOut = ProcessRequest(rawBytesIn);
ar.resume(rawBytesOut);
}
}).start();
}
}