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

The following examples show how to use io.undertow.server.HttpServerExchange#setReasonPhrase() . 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: ResponseReasonPhraseAttribute.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void writeAttribute(final HttpServerExchange exchange, final String newValue) throws ReadOnlyAttributeException {
    exchange.setReasonPhrase(newValue);
}
 
Example 2
Source File: HttpContexts.java    From thorntail with Apache License 2.0 4 votes vote down vote up
private void noHealthEndpoints(HttpServerExchange exchange) {
    exchange.setStatusCode(204);
    exchange.setReasonPhrase("No health endpoints configured!");
}
 
Example 3
Source File: Utils.java    From hawkular-metrics with Apache License 2.0 3 votes vote down vote up
/**
 * Changes the status code of the response, sets the HTTP reason phrase and ends the exchange.
 *
 * @param exchange     the HTTP server request/response exchange
 * @param statusCode   the HTTP status code
 * @param reasonPhrase the HTTP status message
 *
 * @see HttpServerExchange#setStatusCode(int)
 * @see HttpServerExchange#setReasonPhrase(String)
 * @see HttpServerExchange#endExchange()
 */
public static void endExchange(HttpServerExchange exchange, int statusCode, String reasonPhrase) {
    exchange.setStatusCode(statusCode);
    if (reasonPhrase != null) {
        exchange.setReasonPhrase(reasonPhrase);
    }
    exchange.endExchange();
}