Java Code Examples for io.undertow.server.HttpServerExchange#addDefaultResponseListener()

The following examples show how to use io.undertow.server.HttpServerExchange#addDefaultResponseListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleErrorPageHandler.java    From quarkus-http with Apache License 2.0 4 votes vote down vote up
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    exchange.addDefaultResponseListener(responseListener);
    next.handleRequest(exchange);
}
 
Example 2
Source File: SimpleErrorPageHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception {
    exchange.addDefaultResponseListener(responseListener);
    next.handleRequest(exchange);
}
 
Example 3
Source File: ServerDefaultHttpHandler.java    From proteus with Apache License 2.0 3 votes vote down vote up
@Override
public void handleRequest(final HttpServerExchange exchange) throws Exception
{
    if (this.defaultResponseListener != null) {
        exchange.addDefaultResponseListener(defaultResponseListener);
    }

    long fiGlobal = this.headers.fastIterateNonEmpty();

    while (fiGlobal != -1) {
        final HeaderValues headerValues = headers.fiCurrent(fiGlobal);

        exchange.getResponseHeaders().addAll(headerValues.getHeaderName(), headerValues);

        fiGlobal = headers.fiNextNonEmpty(fiGlobal);
    }

    try {

        next.handleRequest(exchange);

    } catch (Exception e) {

        exchange.putAttachment(ExceptionHandler.THROWABLE,e);

        defaultResponseListener.handleDefaultResponse(exchange);
    }
}