Closed xioyaozi closed 6 months ago
Indeed, Vert.x 4 is more conservative: if you have a colon in the path, you must routeWithRegex
like this:
router.routeWithRegex("/catalogue/products/(?<productType>[^/]+)/messages:send")
And then retrieve the param like this:
String productType = routingContext.pathParam("productType");
Questions
When upgrade vertx4, the path cannot support colon, and vertx 3 is ok.
I have read the source code, and consider it is a compatibility issue, hope to fix it in new version.
ps; my avoidance methods is using router.routeWithRegex ,but it need create pattern regex by myself, it is not the best method.
the problem is in io.vertx.ext.web.impl.RouteImpl#setPath
Version
vertx 4.5.7
Context
Exception in thread "main" java.lang.IllegalArgumentException: path param does not follow the variable naming rules, expected (2) found (1) at io.vertx.ext.web.impl.RouteImpl.setPath(RouteImpl.java:308) at io.vertx.ext.web.impl.RouteImpl.(RouteImpl.java:50)
at io.vertx.ext.web.impl.RouterImpl.route(RouterImpl.java:86)
at Main.main(Main.java:10)
Do you have a reproducer?
Extra
NA