當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。