Skip to content

4.1.0 Deprecations and breaking changes

Julien Viet edited this page May 31, 2021 · 9 revisions

Vert.x Core

HTTP client redirect handler should propagate headers

https://github.com/eclipse-vertx/vert.x/issues/3930

The client will not propagate anymore the HTTP headers to the next request, this responsibility has been moved to the HTTP client redirect handler to have full control over the redirected HTTP request.

Here is an excerpt of the current default redirect handler:

RequestOptions options = new RequestOptions();
options.setMethod(HttpMethod.GET);
options.setHost(uri.getHost());
options.setPort(port);
options.setSsl(ssl);
options.setURI(requestURI);

// Since 4.1.0 propagate headers
options.setHeaders(resp.request().headers());
options.removeHeader(CONTENT_LENGTH);

Ignite cluster manager

Config flag systemViewExporterSpiDisabled removed

The new config flag systemViewExporterSpiDisabled from the 4.0.3 release got removed again as it's not compatible with Ignite 2.10.x

Infinispan cluster manager

Upgrade to Infinispan 12

In Vert.x 4.0, event bus registration data was stored in cache as org.infinispan.commons.marshall.WrappedBytes. This was necessary to workaround an Infinispan 11 bug with byte array storage in a multi-map cache.

Infinispan 12 has fixed this bug and using the internal WrappedBytes is no longer necessary.

Vert.x Mongo Client

JSON config takes precedence over connection string

Before 4.1.0, config options were ignored if a connection string was present. They are now taken into account. Consider this configuration object:

{
    mongo:{
        db_name: "mydb"
        connection_string: "mongodb://localhost:27017"
        maxPoolSize: 10
        minPoolSize: 3
    }
}

Before 4.1.0, db_name, maxPoolSize and minPoolSize would have been ignored.

Vert.x Auth

Removed the deprecated JWTOptions methods.

In previous versions JWTOptions.setScopes(List<String>), JWTOptions.addScope(String) and JWTOptions.withScopeDelimiter(String) have been deprecated as they are not spec compliant. These methods have been removed as the exact same behavior can be achieved by using the vertx-web Oauth2 and JWT handlers.

// before 4.1.0
JWTAuthOptions authConfig = new JWTAuthOptions()
  .setJWTOptions(new JWTOptions()
    .addScope("a")
    .addScope("b")
    .withScopeDelimiter(" ")));

JWTAuth authProvider = JWTAuth.create(vertx, authConfig);

router.route("/protected/*").handler(JWTAuthHandler.create(authProvider));

// with 4.1.0
JWTAuth authProvider = JWTAuth.create(vertx, new JWTAuthOptions());

router.route("/protected/*").handler(
  JWTAuthHandler.create(authProvider)
    .addScope("a")
    .addScope("b")
    .withScopeDelimiter(" "));

The JWT handler is now the responsible to handle the scopes. The same applies to OAuth2 handler with the same API and behavior.

Vert.x Web

Deprecated: LoggerHandler.customFormatter(Function)

The LoggerHandler custom formatter method accepting a function has been deprecated and replaced with a custom type. The original method would just receive the source HttpServerRequest and expected a string result. This meant that users would not be able to access the context or even know the time spent.

io.vertx.ext.web.handler.impl.HttpStatusException

The exception io.vertx.ext.web.handler.impl.HttpStatusException is now public under the new name: io.vertx.ext.web.handler.HttpException. This was a internal exception but used commonly, for that reason it is now promoted to an official API class that should follow the non breaking changes contract.

Clone this wiki locally