本文整理匯總了Java中org.eclipse.jetty.http.HttpMethod.values方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpMethod.values方法的具體用法?Java HttpMethod.values怎麽用?Java HttpMethod.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jetty.http.HttpMethod
的用法示例。
在下文中一共展示了HttpMethod.values方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldCreateCounters
import org.eclipse.jetty.http.HttpMethod; //導入方法依賴的package包/類
@Test
public void shouldCreateCounters() {
for (int responseStatus = 1; responseStatus <= 5; responseStatus++) {
assertThat(registry.getKeys("jetty.Response.Invocations")).contains(responseStatus + "xx-responses");
assertThat(registry.getKeys("jetty.Response.Durations")).contains(responseStatus + "xx-responses");
}
assertThat(registry.getKeys("jetty.Response.Invocations")).contains("other-responses");
assertThat(registry.getKeys("jetty.Response.Durations")).contains("other-responses");
for (HttpMethod method : HttpMethod.values()) {
String name = method.asString().toLowerCase();
assertThat(registry.getKeys("jetty.Request.Invocations")).contains(name + "-requests");
assertThat(registry.getKeys("jetty.Request.Durations")).contains(name + "-requests");
}
assertThat(registry.getKeys("jetty.Request.Invocations")).contains("other-requests");
assertThat(registry.getKeys("jetty.Request.Durations")).contains("other-requests");
assertThat(registry.getKeys("jetty.Aggregated.Invocations")).contains("requests");
assertThat(registry.getKeys("jetty.Aggregated.Durations")).contains("requests");
}
示例2: shouldInitializeCounters
import org.eclipse.jetty.http.HttpMethod; //導入方法依賴的package包/類
@Test
public void shouldInitializeCounters() {
for (int responseStatus = 1; responseStatus <= 5; responseStatus++) {
assertThat(registry.get("jetty.Response.Invocations", responseStatus + "xx-responses")).isEqualTo(0);
assertThat(registry.get("jetty.Response.Durations", responseStatus + "xx-responses")).isEqualTo(0);
}
assertThat(registry.get("jetty.Response.Invocations", "other-responses")).isEqualTo(0);
assertThat(registry.get("jetty.Response.Durations", "other-responses")).isEqualTo(0);
for (HttpMethod method : HttpMethod.values()) {
String name = method.asString().toLowerCase();
assertThat(registry.get("jetty.Request.Invocations", name + "-requests")).isEqualTo(0);
assertThat(registry.get("jetty.Request.Durations", name + "-requests")).isEqualTo(0);
}
assertThat(registry.get("jetty.Request.Invocations", "other-requests")).isEqualTo(0);
assertThat(registry.get("jetty.Request.Durations", "other-requests")).isEqualTo(0);
assertThat(registry.get("jetty.Aggregated.Invocations", "requests")).isEqualTo(0);
assertThat(registry.get("jetty.Aggregated.Durations", "requests")).isEqualTo(0);
}
示例3: doStart
import org.eclipse.jetty.http.HttpMethod; //導入方法依賴的package包/類
@Override
protected void doStart() throws Exception {
super.doStart();
for (int responseStatus = 1; responseStatus <= 5; responseStatus++) {
registry.set("jetty.Response.Invocations", responseStatus + "xx-responses", 0);
registry.set("jetty.Response.Durations", responseStatus + "xx-responses", 0);
}
registry.set("jetty.Response.Invocations", "other-responses", 0);
registry.set("jetty.Response.Durations", "other-responses", 0);
for (HttpMethod method : HttpMethod.values()) {
String name = method.asString().toLowerCase();
registry.set("jetty.Request.Invocations", name + "-requests", 0);
registry.set("jetty.Request.Durations", name + "-requests", 0);
}
registry.set("jetty.Request.Invocations", "other-requests", 0);
registry.set("jetty.Request.Durations", "other-requests", 0);
registry.set("jetty.Aggregated.Invocations", "requests", 0);
registry.set("jetty.Aggregated.Durations", "requests", 0);
registry.set("jetty.Thread.Gauges", "threads", (Gauge) () -> getServer().getThreadPool().getThreads());
registry.set("jetty.Thread.Gauges", "idle-threads", (Gauge) () -> getServer().getThreadPool().getIdleThreads());
if (getServer().getThreadPool() instanceof QueuedThreadPool) {
registry.set("jetty.Thread.Gauges", "busy-threads",
(Gauge) () -> ((QueuedThreadPool) getServer().getThreadPool()).getBusyThreads());
registry.set("jetty.Thread.Gauges", "min-threads",
(Gauge) () -> ((QueuedThreadPool) getServer().getThreadPool()).getMinThreads());
registry.set("jetty.Thread.Gauges", "max-threads",
(Gauge) () -> ((QueuedThreadPool) getServer().getThreadPool()).getMaxThreads());
}
}