org.zkoss.zk.ui.Execution.getHeader()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.zkoss.zk.ui.Execution.getHeader()方法的一些代码示例,展示了Execution.getHeader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Execution.getHeader()方法的具体详情如下:
包路径:org.zkoss.zk.ui.Execution
类名称:Execution
方法名:getHeader

Execution.getHeader介绍

[英]Returns the value of the specified header as a String, or null if not found.
[中]以字符串形式返回指定标头的值,如果未找到,则返回null。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

/** Handles the client complete of AU request for performance measurement.
 */
private static void meterAuClientComplete(PerformanceMeter pfmeter, Execution exec) {
  //Format of ZK-Client-Complete and ZK-Client-Receive:
  //	request-id1=time1,request-id2=time2
  String hdr = exec.getHeader("ZK-Client-Receive");
  if (hdr != null)
    meterAuClient(pfmeter, exec, hdr, false);
  hdr = exec.getHeader("ZK-Client-Complete");
  if (hdr != null)
    meterAuClient(pfmeter, exec, hdr, true);
}

代码示例来源:origin: org.zkoss.zk/zk

public String getHeader(String name) {
  return exec().getHeader(name);
}

代码示例来源:origin: org.zkoss.zk/zk

/** Handles the client and server start of AU request
 * for the performance measurement.
 *
 * @return the request ID from the ZK-Client-Start header,
 * or null if not found.
 */
private static String meterAuStart(PerformanceMeter pfmeter, Execution exec, long startTime) {
  //Format of ZK-Client-Start:
  //	request-id=time
  String hdr = exec.getHeader("ZK-Client-Start");
  if (hdr != null) {
    final int j = hdr.lastIndexOf('=');
    if (j > 0) {
      final String pfReqId = hdr.substring(0, j);
      try {
        pfmeter.requestStartAtClient(pfReqId, exec, Long.parseLong(hdr.substring(j + 1)));
        pfmeter.requestStartAtServer(pfReqId, exec, startTime);
      } catch (NumberFormatException ex) {
        log.warn("Ingored: failed to parse ZK-Client-Start, " + hdr);
      } catch (Throwable ex) {
        log.warn("Ingored: failed to invoke " + pfmeter, ex);
      }
      return pfReqId;
    }
  }
  return null;
}

代码示例来源:origin: org.zkoss.zk/zkbind

public Object resolveParameter(Annotation anno, Class<?> returnType) {
    Object val = _execution.getHeader(((HeaderParam) anno).value());
    return val == null ? null : Classes.coerce(returnType, val);
  }
});

代码示例来源:origin: org.zkoss.zk/zkbind

public void addInfo(ExecutionInfo info) {
  JSONObject json = ((ExecutionInfoBase) info).toJSON();
  json.put("stack", _infoStack.size());
  Execution exec = Executions.getCurrent();
  String sid = exec.getHeader("ZK-SID");
  int sid0 = 0;
  try {
    sid0 = sid == null ? sid0 : Integer.parseInt(sid);
  } catch (Exception x) {
  }
  json.put("sid", Integer.valueOf(sid0));
  
  addInfo(json);

}

相关文章