Java Code Examples for io.vertx.core.http.HttpServerRequest#version()

The following examples show how to use io.vertx.core.http.HttpServerRequest#version() . 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: RequestProtocolAccessItem.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@Override
public void appendServerFormattedItem(ServerAccessLogEvent accessLogEvent, StringBuilder builder) {
  HttpServerRequest request = accessLogEvent.getRoutingContext().request();
  if (null == request || null == request.version()) {
    builder.append(EMPTY_RESULT);
    return;
  }
  builder.append(getStringVersion(request.version()));
}
 
Example 2
Source File: HttpUtils.java    From wisdom with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether the given request should be closed or not once completed.
 *
 * @param request the request
 * @return {@code true} if the connection is marked as {@literal keep-alive}, and so must not be closed. {@code
 * false} otherwise. Notice that if not set in the request, the default value depends on the HTTP version.
 */
public static boolean isKeepAlive(HttpServerRequest request) {
    String connection = request.headers().get(HeaderNames.CONNECTION);
    if (connection != null && connection.equalsIgnoreCase(CLOSE)) {
        return false;
    }
    if (request.version() == HttpVersion.HTTP_1_1) {
        return !CLOSE.equalsIgnoreCase(connection);
    } else {
        return KEEP_ALIVE.equalsIgnoreCase(connection);
    }
}
 
Example 3
Source File: VertxHttpServerResponse.java    From graviteeio-access-management with Apache License 2.0 4 votes vote down vote up
public VertxHttpServerResponse(final HttpServerRequest httpServerRequest, final Metrics metrics) {
    this.httpServerResponse = httpServerRequest.response();
    version = httpServerRequest.version();
    this.metrics = metrics;
}
 
Example 4
Source File: VertxHttpServerResponse.java    From gravitee-gateway with Apache License 2.0 4 votes vote down vote up
public VertxHttpServerResponse(final HttpServerRequest httpServerRequest, final Metrics metrics) {
    this.httpServerResponse = httpServerRequest.response();
    version = httpServerRequest.version();
    this.metrics = metrics;
}