-1
我想要得到的網狀通道做一些@DELETE的功能:RestEasy如何獲得Netty頻道?
@DELETE
@Path( 「/文件/ {PATH}」)
@Produces(「應用/ JSON;字符集= UTF-8" )
公共響應DELETEFILE(
@PathParam("path") String path,
@QueryParam(value = "access") String access,
@Context HttpResponse httpResponse)
{
//i want to get the netty channel to do something.
}
,但不能得到。 只見RestEasy的的資源代碼:
公共對象的invoke(HttpRequest的要求,HttpResponse對象HttpResponse對象,對象資源)拋出故障,ApplicationException的
{
Object[] args = injectArguments(request, httpResponse);
GeneralValidator validator = GeneralValidator.class.cast(request.getAttribute(GeneralValidator.class.getName()));
if (validator != null)
{
validator.validateAllParameters(request, resource, method.getMethod(), args);
}
Method invokedMethod = method.getMethod();
if (!invokedMethod.getDeclaringClass().isAssignableFrom(resource.getClass()))
{
// invokedMethod is for when the target object might be a proxy and
// resteasy is getting the bean class to introspect.
// In other words ResourceMethod.getMethod() does not have the same declared class as the proxy:
// An example is a proxied Spring bean that is a resource
// interface ProxiedInterface { String get(); }
// @Path("resource") class MyResource implements ProxiedInterface {
// @GET String get() {...}
// }
//
invokedMethod = interfaceBasedMethod;
}
Object result = null;
try
{
result = invokedMethod.invoke(resource, args);
}
catch (IllegalAccessException e)
{
throw new InternalServerErrorException("Not allowed to reflect on method: " + method.toString(), e);
}
的HttpResponse類HTTPResponse的參數表是一個NettyHttpResponse對象,所以我可以通過它獲得通道。
那麼我怎樣才能獲得頻道?
好吧,我修改的HttpResponse的實現細節,因此這個頻道的成功,得益於諾曼·毛雷爾。 – zhongcy