use of io.undertow.server.handlers.BlockingHandler in project undertow by undertow-io.
the class ContentOverrunTestCase method setup.
@BeforeClass
public static void setup() {
HttpHandler overlyLong = new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.setResponseContentLength(10);
exchange.getOutputStream().write("Overly long content".getBytes(StandardCharsets.UTF_8));
}
};
HttpHandler responseNotAllowed = new HttpHandler() {
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
exchange.setStatusCode(204);
exchange.getOutputStream().write("Overly long content".getBytes(StandardCharsets.UTF_8));
}
};
DefaultServer.setRootHandler(Handlers.path().addPrefixPath("/204", new BlockingHandler(responseNotAllowed)).addPrefixPath("/long", new BlockingHandler(overlyLong)));
}
Aggregations