/** * 返回当前Action对应的HttpComponent的执行时间过滤轨迹分析器 * * @return 根据执行时间进行过滤的轨迹分析器 * @see Analyser */ private TimeFilterAnalyser getTimeFilterAnalyser() { ActionContext actionContext = this.getActionContext(); Assert.assertNotNull(actionContext, "actionContext is null."); ComponentContext componentContext = actionContext.getComponentContext(); Assert.assertNotNull(componentContext, "componentContext is null."); HttpComponent component = (HttpComponent) componentContext.getComponent(); /** 获得http请求轨迹分析器,以获得分析数据 */ TimeFilterAnalyser analyser = component.getTimeAnalyser(); return analyser; }
public JSONObject processJson(HttpServletRequest request, HttpServletResponse response) throws Exception { /** 获得http请求轨迹分析器,以获得分析数据 */ TimeFilterAnalyser analyser = getTimeFilterAnalyser(); Assert.assertNotNull(analyser, "HttpComponent is not startup:time filter analyser is null."); TimeFilterViewHelper helper = new TimeFilterViewHelper(analyser); return helper.processJson(request, response); }
public void process(HttpServletRequest request, HttpServletResponse response, Context context) throws Exception { /** 获得http请求轨迹分析器,以获得分析数据 */ TimeFilterAnalyser analyser = getTimeFilterAnalyser(); Assert.assertNotNull(analyser, "HttpComponent is not startup:time filter analyser is null."); // http请求超时的时间 long time = analyser.getTracefilterActivetime(); // http请求超时轨迹最大记录数 int max = analyser.getMaxTraceSize(); /** 设置模版上下文 */ context.put("overTime", new Long(time)); context.put("maxTrace", new Integer(max)); }