本文整理汇总了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());
}
}