io.vertx.core.http.HttpVersion Java Examples

The following examples show how to use io.vertx.core.http.HttpVersion. 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: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 6 votes vote down vote up
private void testSecureRequest(boolean useAlpn) {
    Properties properties = new Properties();
    properties.setProperty("vertx.http.client.ssl", "true");
    properties.setProperty("vertx.http.client.use-alpn", String.valueOf(useAlpn));
    properties.setProperty("vertx.http.client.protocol-version",
        useAlpn ? HttpVersion.HTTP_2.name() : HttpVersion.HTTP_1_1.name());
    properties.setProperty("vertx.http.server.ssl", "true");
    properties.setProperty("vertx.http.server.useAlpn", Boolean.toString(useAlpn));
    properties.setProperty("vertx.http.server.client-auth", ClientAuth.REQUIRED.name());
    properties.setProperty("server.ssl.key-store-type", "JKS");
    properties.setProperty("server.ssl.key-store", SERVER_KEYSTORE.getPath());
    properties.setProperty("server.ssl.key-store-password", SERVER_KEYSTORE.getPassword());
    properties.setProperty("server.ssl.trust-store-type", "JKS");
    properties.setProperty("server.ssl.trust-store", SERVER_TRUSTSTORE.getPath());
    properties.setProperty("server.ssl.trust-store-password", SERVER_TRUSTSTORE.getPassword());


    startServerWithoutSecurity(properties, ClientStoresCustomizer.class, useAlpn ? NoopHttp2Router.class : NoopHttp11Router.class);

    getWebTestClient()
        .get()
        .exchange()
        .expectStatus()
        .isNoContent();
}
 
Example #2
Source File: RequestProtocolItemTest.java    From servicecomb-java-chassis with Apache License 2.0 6 votes vote down vote up
@Test
public void serverFormattedElement() {
  when(routingContext.request()).thenReturn(serverRequest);
  when(serverRequest.version()).thenReturn(HttpVersion.HTTP_1_1);

  ITEM.appendServerFormattedItem(accessLogEvent, strBuilder);
  assertEquals("HTTP/1.1", strBuilder.toString());

  strBuilder = new StringBuilder();
  when(serverRequest.version()).thenReturn(HttpVersion.HTTP_1_0);
  ITEM.appendServerFormattedItem(accessLogEvent, strBuilder);
  assertEquals("HTTP/1.0", strBuilder.toString());

  strBuilder = new StringBuilder();
  when(serverRequest.version()).thenReturn(HttpVersion.HTTP_2);
  ITEM.appendServerFormattedItem(accessLogEvent, strBuilder);
  assertEquals("HTTP/2.0", strBuilder.toString());
}
 
Example #3
Source File: VertxHttp2ClientReconnectTest.java    From feign-vertx with Apache License 2.0 6 votes vote down vote up
/**
 * Create a Feign Vertx client that is built once and used several times
 * during positive and negative test cases.
 * @param context
 */
@Before
public void before(TestContext context) {
  // for HTTP2 test, set up the protocol and the pool size to 1.
  HttpClientOptions options = new HttpClientOptions();
  options
      .setProtocolVersion(HttpVersion.HTTP_2)
      .setHttp2MaxPoolSize(1);

  client = VertxFeign
      .builder()
      .vertx(this.vertx)
      .options(options)
      .encoder(new JacksonEncoder())
      .decoder(new JacksonDecoder())
      .target(HelloServiceAPI.class, "http://localhost:8091");
}
 
Example #4
Source File: Http2TestCase.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@Test
public void testHttp2EnabledSsl() throws ExecutionException, InterruptedException {
    Assumptions.assumeTrue(JdkSSLEngineOptions.isAlpnAvailable()); //don't run on JDK8
    Vertx vertx = Vertx.vertx();
    try {
        WebClientOptions options = new WebClientOptions()
                .setUseAlpn(true)
                .setProtocolVersion(HttpVersion.HTTP_2)
                .setSsl(true)
                .setKeyStoreOptions(
                        new JksOptions().setPath("src/test/resources/client-keystore.jks").setPassword("password"))
                .setTrustStoreOptions(
                        new JksOptions().setPath("src/test/resources/client-truststore.jks").setPassword("password"));

        WebClient client = WebClient.create(vertx, options);
        int port = sslUrl.getPort();

        runTest(client, port);

    } finally {
        vertx.close();
    }
}
 
Example #5
Source File: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 6 votes vote down vote up
@Bean
public RouterFunction<ServerResponse> noopHttp11Router() {
    return route()
        .GET("/", request -> {
            HttpServerRequest vertxRequest = getHttpServerRequest(request);

            if (!HttpVersion.HTTP_1_1.equals(vertxRequest.version())) {
                return status(HttpStatus.BAD_REQUEST).syncBody("Not HTTP1.1 request");
            }
            if (!vertxRequest.isSSL()) {
                return status(HttpStatus.BAD_REQUEST).syncBody("Not SSL request");
            }
            return noContent().build();
        })
        .build();
}
 
Example #6
Source File: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 6 votes vote down vote up
@Bean
public RouterFunction<ServerResponse> noopHttp2Router() {
    return route()
        .GET("/", request -> {
            HttpServerRequest vertxRequest = getHttpServerRequest(request);

            System.out.println(vertxRequest.sslSession());
            if (!HttpVersion.HTTP_2.equals(vertxRequest.version())) {
                return status(HttpStatus.BAD_REQUEST).syncBody("Not HTTP2 request");
            }
            if (!vertxRequest.isSSL()) {
                return status(HttpStatus.BAD_REQUEST).syncBody("Not SSL request");
            }
            return noContent().build();
        })
        .build();
}
 
Example #7
Source File: HttpResponseImpl.java    From vertx-web with Apache License 2.0 6 votes vote down vote up
public HttpResponseImpl(HttpVersion version,
                        int statusCode,
                        String statusMessage,
                        MultiMap headers,
                        MultiMap trailers,
                        List<String> cookies,
                        T body, List<String> redirects) {
  this.version = version;
  this.statusCode = statusCode;
  this.statusMessage = statusMessage;
  this.headers = headers;
  this.trailers = trailers;
  this.cookies = cookies;
  this.body = body;
  this.redirects = redirects;
}
 
Example #8
Source File: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 6 votes vote down vote up
private void testUntrustedClient(boolean useAlpn) {
    Properties properties = new Properties();
    properties.setProperty("vertx.http.client.ssl", "true");
    properties.setProperty("vertx.http.client.use-alpn", String.valueOf(useAlpn));
    properties.setProperty("vertx.http.client.protocol-version",
        useAlpn ? HttpVersion.HTTP_2.name() : HttpVersion.HTTP_1_1.name());
    properties.setProperty("vertx.http.server.ssl", "true");
    properties.setProperty("vertx.http.server.useAlpn", Boolean.toString(useAlpn));
    properties.setProperty("vertx.http.server.client-auth", ClientAuth.REQUIRED.name());
    properties.setProperty("server.ssl.key-store-type", "JKS");
    properties.setProperty("server.ssl.key-store", SERVER_KEYSTORE.getPath());
    properties.setProperty("server.ssl.key-store-password", SERVER_KEYSTORE.getPassword());

    startServerWithoutSecurity(properties, ClientStoresCustomizer.class, useAlpn ? NoopHttp2Router.class : NoopHttp11Router.class);

    try {
        getWebTestClient()
            .get()
            .exchange();
        fail("SSLHandshakeException expected");
    } catch (RuntimeException e) {
        assertThat(e.getCause()).isInstanceOf(SSLHandshakeException.class);
    }
}
 
Example #9
Source File: HttpServerPropertiesIT.java    From vertx-spring-boot with Apache License 2.0 6 votes vote down vote up
@Test
public void verifyHttpServerProperties() {
    Properties originalProperties = new Properties();
    originalProperties.setProperty("vertx.http.server.host", "localhost");
    originalProperties.setProperty("vertx.http.server.port", "8082");
    originalProperties.setProperty("vertx.http.server.client-auth", "REQUIRED");
    originalProperties.setProperty("vertx.http.server.sni", "true");
    originalProperties.setProperty("vertx.http.server.alpn-versions", "HTTP_1_1,HTTP_2");
    originalProperties.setProperty("vertx.http.server.http2-extra-settings.1", "10");
    originalProperties.setProperty("vertx.http.server.http2-extra-settings.2", "20");
    originalProperties.setProperty("vertx.http.server.idle-timeout-unit", "HOURS");
    originalProperties.setProperty("vertx.http.server.enabled-cipher-suites", "cipher1,cipher2");
    startServerWithoutSecurity(originalProperties);

    HttpServerProperties expectedProperties = getBean(HttpServerProperties.class);

    assertThat(expectedProperties.getPort()).isEqualTo(8082);
    assertThat(expectedProperties.getHost()).isEqualTo("localhost");
    assertThat(expectedProperties.getClientAuth()).isEqualTo(ClientAuth.REQUIRED);
    assertThat(expectedProperties.isSni()).isTrue();
    assertThat(expectedProperties.getAlpnVersions()).containsOnly(HttpVersion.HTTP_1_1, HttpVersion.HTTP_2);
    assertThat(expectedProperties.getHttp2ExtraSettings())
        .containsOnly(new HashMap.SimpleEntry<>(1, 10L), new HashMap.SimpleEntry<>(2, 20L));
    assertThat(expectedProperties.getIdleTimeoutUnit()).isEqualTo(TimeUnit.HOURS);
    assertThat(expectedProperties.getEnabledCipherSuites()).containsOnly("cipher1", "cipher2");
}
 
Example #10
Source File: HttpClientPropertiesIT.java    From vertx-spring-boot with Apache License 2.0 6 votes vote down vote up
@Test
public void verifyHttpClientProperties() {
    Properties originalProperties = new Properties();
    originalProperties.setProperty("vertx.http.client.default-host", "localhost");
    originalProperties.setProperty("vertx.http.client.default-port", "8082");
    originalProperties.setProperty("vertx.http.client.protocol-version", "HTTP_2");
    originalProperties.setProperty("vertx.http.client.force-sni", "true");
    originalProperties.setProperty("vertx.http.client.http2-extra-settings.1", "10");
    originalProperties.setProperty("vertx.http.client.http2-extra-settings.2", "20");
    originalProperties.setProperty("vertx.http.client.idle-timeout-unit", "HOURS");
    originalProperties.setProperty("vertx.http.client.enabled-cipher-suites", "cipher1,cipher2");
    startServerWithoutSecurity(originalProperties);

    HttpClientProperties expectedProperties = getBean(HttpClientProperties.class);

    assertThat(expectedProperties.getDefaultPort()).isEqualTo(8082);
    assertThat(expectedProperties.getDefaultHost()).isEqualTo("localhost");
    assertThat(expectedProperties.getProtocolVersion()).isEqualTo(HttpVersion.HTTP_2);
    assertThat(expectedProperties.isForceSni()).isTrue();
    assertThat(expectedProperties.getHttp2ExtraSettings())
        .containsOnly(new HashMap.SimpleEntry<>(1, 10L), new HashMap.SimpleEntry<>(2, 20L));
    assertThat(expectedProperties.getIdleTimeoutUnit()).isEqualTo(TimeUnit.HOURS);
    assertThat(expectedProperties.getEnabledCipherSuites()).containsOnly("cipher1", "cipher2");
}
 
Example #11
Source File: LoggerHandlerImpl.java    From vertx-web with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(RoutingContext context) {
  // common logging data
  long timestamp = System.currentTimeMillis();
  String remoteClient = getClientAddress(context.request().remoteAddress());
  HttpMethod method = context.request().method();
  String uri = context.request().uri();
  HttpVersion version = context.request().version();

  if (immediate) {
    log(context, timestamp, remoteClient, version, method, uri);
  } else {
    context.addBodyEndHandler(v -> log(context, timestamp, remoteClient, version, method, uri));
  }

  context.next();

}
 
Example #12
Source File: HttpUtilsTest.java    From wisdom with Apache License 2.0 6 votes vote down vote up
@Test
public void testIsKeepAlive() throws Exception {
    MultiMap headers = MultiMap.caseInsensitiveMultiMap();
    HttpServerRequest req = mock(HttpServerRequest.class);
    when(req.headers()).thenReturn(headers);

    // Connection header set.
    headers.add(HeaderNames.CONNECTION, HttpUtils.CLOSE);
    assertThat(HttpUtils.isKeepAlive(req)).isFalse();

    headers.add(HeaderNames.CONNECTION, HttpUtils.KEEP_ALIVE);
    assertThat(HttpUtils.isKeepAlive(req)).isTrue();

    // Unset connection header
    headers.clear();
    when(req.version()).thenReturn(HttpVersion.HTTP_1_1);
    assertThat(HttpUtils.isKeepAlive(req)).isTrue();

    when(req.version()).thenReturn(HttpVersion.HTTP_1_0);
    assertThat(HttpUtils.isKeepAlive(req)).isFalse();
}
 
Example #13
Source File: HttpApiFactory.java    From apiman with Apache License 2.0 5 votes vote down vote up
public static void buildResponse(HttpServerResponse httpServerResponse, ApiResponse amanResponse, HttpVersion httpVersion) {
    amanResponse.getHeaders().forEach(e -> {
        if (httpVersion == HttpVersion.HTTP_1_0 || httpVersion == HttpVersion.HTTP_1_1 || !e.getKey().equals("Connection")) {
            httpServerResponse.headers().add(e.getKey(), e.getValue());
        }
    });
    httpServerResponse.setStatusCode(amanResponse.getCode());
    httpServerResponse.setStatusMessage(amanResponse.getMessage() == null ? "" : amanResponse.getMessage());
}
 
Example #14
Source File: Http2Test.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Test
public void testHttp2EnabledSsl() throws ExecutionException, InterruptedException {
    Assumptions.assumeTrue(JdkSSLEngineOptions.isAlpnAvailable()); //don't run on JDK8
    WebClientOptions options = new WebClientOptions()
            .setUseAlpn(true)
            .setProtocolVersion(HttpVersion.HTTP_2)
            .setSsl(true)
            .setTrustAll(true);
    WebClient client = WebClient.create(VertxCoreRecorder.getVertx().get(), options);
    int port = sslUrl.getPort();

    runTest(client, port);
}
 
Example #15
Source File: Http2Test.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Test
public void testHttp2EnabledPlain() throws ExecutionException, InterruptedException {
    WebClientOptions options = new WebClientOptions()
            .setProtocolVersion(HttpVersion.HTTP_2)
            .setHttp2ClearTextUpgrade(true);
    WebClient client = WebClient.create(VertxCoreRecorder.getVertx().get(), options);
    runTest(client, url.getPort());
}
 
Example #16
Source File: Http2TestCase.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Test
public void testHttp2EnabledPlain() throws ExecutionException, InterruptedException {
    Vertx vertx = Vertx.vertx();
    try {
        WebClientOptions options = new WebClientOptions()
                .setProtocolVersion(HttpVersion.HTTP_2)
                .setHttp2ClearTextUpgrade(true);
        WebClient client = WebClient.create(vertx, options);
        runTest(client, url.getPort());

    } finally {
        vertx.close();
    }
}
 
Example #17
Source File: HttpClientOptionsSPI.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
static HttpClientOptions createHttpClientOptions(HttpClientOptionsSPI spi) {
  HttpClientOptions httpClientOptions = new HttpClientOptions();

  httpClientOptions.setProtocolVersion(spi.getHttpVersion());
  httpClientOptions.setConnectTimeout(spi.getConnectTimeoutInMillis());
  httpClientOptions.setIdleTimeout(spi.getIdleTimeoutInSeconds());
  httpClientOptions.setTryUseCompression(spi.isTryUseCompression());
  httpClientOptions.setMaxWaitQueueSize(spi.getMaxWaitQueueSize());
  httpClientOptions.setMaxPoolSize(spi.getMaxPoolSize());
  httpClientOptions.setKeepAlive(spi.isKeepAlive());
  httpClientOptions.setMaxHeaderSize(spi.getMaxHeaderSize());
  httpClientOptions.setKeepAliveTimeout(spi.getKeepAliveTimeout());

  if (spi.isProxyEnable()) {
    ProxyOptions proxy = new ProxyOptions();
    proxy.setHost(spi.getProxyHost());
    proxy.setPort(spi.getProxyPort());
    proxy.setUsername(spi.getProxyUsername());
    proxy.setPassword(
        Encryptions.decode(spi.getProxyPassword(), spi.getConfigTag()));
    httpClientOptions.setProxyOptions(proxy);
  }

  if (spi.getHttpVersion() == HttpVersion.HTTP_2) {
    httpClientOptions.setHttp2ClearTextUpgrade(false);
    httpClientOptions.setUseAlpn(spi.isUseAlpn());
    httpClientOptions.setHttp2MultiplexingLimit(spi.getHttp2MultiplexingLimit());
    httpClientOptions.setHttp2MaxPoolSize(spi.getHttp2MaxPoolSize());
  }

  if (spi.isSsl()) {
    VertxTLSBuilder.buildHttpClientOptions(spi.getConfigTag(), httpClientOptions);
  }

  return httpClientOptions;
}
 
Example #18
Source File: RequestProtocolAccessItem.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
private String getStringVersion(HttpVersion version) {
  switch (version) {
    case HTTP_2:
      return "HTTP/2.0";
    case HTTP_1_0:
      return "HTTP/1.0";
    case HTTP_1_1:
      return "HTTP/1.1";
    default:
      return EMPTY_RESULT;
  }
}
 
Example #19
Source File: HttpSslIT.java    From vertx-spring-boot with Apache License 2.0 5 votes vote down vote up
private void testEngine(boolean useAlpn, Engine engine) {
    Properties properties = new Properties();
    properties.setProperty("vertx.http.client.ssl", "true");
    properties.setProperty("vertx.http.client.use-alpn", String.valueOf(useAlpn));
    properties.setProperty("vertx.http.client.trust-all", "true");
    properties.setProperty("vertx.http.client.protocol-version",
        useAlpn ? HttpVersion.HTTP_2.name() : HttpVersion.HTTP_1_1.name());
    properties.setProperty("vertx.http.server.ssl", "true");
    properties.setProperty("vertx.http.server.useAlpn", Boolean.toString(useAlpn));

    List<Class> classes = new LinkedList<>();
    classes.add(ServerKeyCertCustomizer.class);
    classes.add(useAlpn ? NoopHttp2Router.class : NoopHttp11Router.class);

    switch (engine) {
        case JDK:
            classes.add(JdkSslEngineOptionsCustomizers.class);
            break;
        case OPENSSL:
            classes.add(OpenSslEngineOptionsCustomizers.class);
    }

    startServerWithoutSecurity(properties, classes.toArray(new Class[]{}));

    getWebTestClient()
        .get()
        .exchange()
        .expectStatus()
        .isNoContent();
}
 
Example #20
Source File: VertxHttpServerResponse.java    From graviteeio-access-management with Apache License 2.0 5 votes vote down vote up
private void writeHeaders() {
    // As per https://tools.ietf.org/html/rfc7540#section-8.1.2.2
    // connection-specific header fields must be remove from response headers
    headers.forEach((headerName, headerValues) -> {
        if (version == HttpVersion.HTTP_1_0 || version == HttpVersion.HTTP_1_1
                || (!headerName.equalsIgnoreCase(HttpHeaders.CONNECTION)
                && !headerName.equalsIgnoreCase(HttpHeaders.KEEP_ALIVE)
                && !headerName.equalsIgnoreCase(HttpHeaders.TRANSFER_ENCODING))) {
            httpServerResponse.putHeader(headerName, headerValues);
        }
    });
}
 
Example #21
Source File: S3ClientRequest.java    From vertx-s3-client with Apache License 2.0 5 votes vote down vote up
@Override
public S3ClientRequest sendHead(Handler<HttpVersion> handler) {
    initAuthenticationHeaderBeforePayload();

    request.sendHead(handler);
    return this;
}
 
Example #22
Source File: VertxHttpServerResponse.java    From gravitee-gateway with Apache License 2.0 5 votes vote down vote up
private void writeHeaders() {
    // As per https://tools.ietf.org/html/rfc7540#section-8.1.2.2
    // connection-specific header fields must be remove from response headers
    headers.forEach((headerName, headerValues) -> {
        if (version == HttpVersion.HTTP_1_0 || version == HttpVersion.HTTP_1_1
                || (!headerName.equalsIgnoreCase(HttpHeaders.CONNECTION)
                && !headerName.equalsIgnoreCase(HttpHeaders.KEEP_ALIVE)
                && !headerName.equalsIgnoreCase(HttpHeaders.TRANSFER_ENCODING))) {
            httpServerResponse.putHeader(headerName, headerValues);
        }
    });
}
 
Example #23
Source File: TypedParamInjectorRegistry.java    From nubes with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"unchecked", "rawtypes"})
public TypedParamInjectorRegistry(Config config) {
  map = new HashMap<>();
  registerInjector(Vertx.class, new VertxParamInjector());
  registerInjector(Session.class, new SessionParamInjector());
  registerInjector(RoutingContext.class, new RoutingContextParamInjector());
  registerInjector(Payload.class, new PayloadParamInjector());
  registerInjector(PaginationContext.class, new PaginationContextParamInjector());
  registerInjector(EventBus.class, new EventBusParamInjector());
  registerInjector(ResourceBundle.class, new ResourceBundleParamInjector(config));
  registerInjector(HttpServerRequest.class, new RequestParamInjector());
  registerInjector(HttpServerResponse.class, new ResponseParamInjector());
  registerInjector(SocketAddress.class, new SocketAddressParamInjector());
  registerInjector(HttpVersion.class, new HttpVersionParamInjector());
}
 
Example #24
Source File: XhrTransport.java    From vertx-web with Apache License 2.0 5 votes vote down vote up
final void beforeSend() {
  if (log.isTraceEnabled()) log.trace("XHR sending frame");
  if (!headersWritten) {
    HttpServerResponse resp = rc.response();
    resp.putHeader(HttpHeaders.CONTENT_TYPE, "application/javascript; charset=UTF-8");
    setJSESSIONID(options, rc);
    setCORS(rc);
    if (rc.request().version() != HttpVersion.HTTP_1_0) {
      resp.setChunked(true);
    }
    // NOTE that this is streaming!!!
    // Client are not expecting to see Content-Length as we don't know it's value
    headersWritten = true;
  }
}
 
Example #25
Source File: DataObject.java    From vertx-codetrans with Apache License 2.0 5 votes vote down vote up
@CodeTranslate
public void toJson() throws Exception {
  JsonObject jsonObject = new JsonObject();
  ServerOptions serverOptions = new ServerOptions()
    .setProtocolVersion(HttpVersion.HTTP_2)
    .setPort(8080)
    .setKeyStore(new KeyStoreOptions().setPath("/keystore").setPassword("r00t"));
  jsonObject.put("result", serverOptions.toJson());
  DataObjectTest.o = jsonObject;
}
 
Example #26
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 #27
Source File: FirstLineOfRequestItemTest.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
@Test
public void serverFormattedElement() {
  HttpServerRequest request = Mockito.mock(HttpServerRequest.class);
  String uri = "/test/uri";

  when(mockContext.request()).thenReturn(request);
  when(request.method()).thenReturn(HttpMethod.DELETE);
  when(request.path()).thenReturn(uri);
  when(request.version()).thenReturn(HttpVersion.HTTP_1_1);

  ELEMENT.appendServerFormattedItem(accessLogEvent, strBuilder);
  assertEquals("\"DELETE " + uri + " HTTP/1.1\"", strBuilder.toString());
}
 
Example #28
Source File: WebClientOptions.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@Override
public WebClientOptions setAlpnVersions(List<HttpVersion> alpnVersions) {
  return (WebClientOptions) super.setAlpnVersions(alpnVersions);
}
 
Example #29
Source File: HttpResponseImpl.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@Override
public HttpVersion version() {
  return version;
}
 
Example #30
Source File: InterceptorTest.java    From vertx-web with Apache License 2.0 4 votes vote down vote up
@Override
public HttpVersion version() {
  return HttpVersion.HTTP_1_1;
}