本文整理匯總了Java中io.vertx.core.http.HttpClientRequest.method方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpClientRequest.method方法的具體用法?Java HttpClientRequest.method怎麽用?Java HttpClientRequest.method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.http.HttpClientRequest
的用法示例。
在下文中一共展示了HttpClientRequest.method方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: requestBegin
import io.vertx.core.http.HttpClientRequest; //導入方法依賴的package包/類
/**
* Only requests that contain a tracking tag will be tracked
*/
@Override
@Nullable
public HttpRequestMetrics requestBegin(final Void endpointMetric,
final SocketAddress socketMetric,
final SocketAddress localAddress,
final SocketAddress remoteAddress,
final HttpClientRequest request) {
// extract request tag to identify the metric and confirm that we want to track it
String requestTag = request.headers().get(Tags.TRACK_HEADER.toString());
HttpRequestMetrics metric = null;
if (requestTag != null) {
// Remove tracking header to avoid it propagating to clients
request.headers().remove(Tags.TRACK_HEADER.toString());
// Create client request metric
metric = new HttpRequestMetrics(requestTag, remoteAddress, request.method());
metric.start();
}
return metric;
}