0

我们如何使用org.eclipse.jetty.continuation.Continuation类处理单个 HTTP keep-Alive 请求的每秒事务数。

我扩展了org.apache.camel.component.http.CamelServlet并覆盖了它的服务方法,在 HTTPConsumer 的帮助下我得到了骆驼交换。

我无法弄清楚如何在这个单一的 HttpRequest 对象中获取交易数量。

这是代码:-

protected void service(HttpServletRequest request, HttpServletResponse response) 
{
   HttpConsumer consumer = resolve(request);
if (consumer == null)
{
response.sendError(404);
return;
}
if ((consumer.getEndpoint().getHttpMethodRestrict() != null) && (!consumer.getEndpoint().getHttpMethodRestrict().equals(request.getMethod())))
{
response.sendError(405);
return;
}
if (("TRACE".equals(request.getMethod())) && (!consumer.isTraceEnabled()))
{
response.sendError(405);
return;
}
Exchange result = (Exchange)request.getAttribute("CamelExchange");
if (result == null)
{
final Continuation continuation = ContinuationSupport.getContinuation(request);
//After getting continuation,
//How to get the count for Number of Transaction Happen Inside this Single HTTPRequest (in this case request object)  
4

0 回答 0