APISonar


org.rapidoid.http.Handlers.json

> org > rapidoid > http > Handlers > json
org APIs rapidoid APIs http APIs Handlers APIs json APIs

Example 1
public void testHttpServer() {
		HTTP.DEFAULT_CLIENT.reset();
		WebApp app = WebAppGroup.openRootContext();

		app.getRouter().get("/", Handlers.html("home"));
		app.getRouter().generic(Handlers.json("123"));

		HTTPServer server = HTTP.server().applications(WebAppGroup.main()).build().start();

		eq(new String(HTTP.get("http://localhost:8080/")), "home");
		eq(new String(HTTP.post("http://localhost:8080/")), "123");

		server.shutdown();
		Ctxs.close();
	}