当前位置: 首页>>代码示例>>Java>>正文


Java HttpMethod.values方法代码示例

本文整理汇总了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");
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:19,代码来源:InstrumentedHandlerTest.java

示例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);
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:19,代码来源:InstrumentedHandlerTest.java

示例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());
	}
}
 
开发者ID:mevdschee,项目名称:tqdev-metrics,代码行数:32,代码来源:InstrumentedHandler.java


注:本文中的org.eclipse.jetty.http.HttpMethod.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。