What is the analog of RouteMatcher on vert.x 3.2.1?

180 views
Skip to first unread message

Сэм Фишер

unread,
Apr 15, 2016, 5:32:21 AM4/15/16
to vert.x
I saw that it was possibly to use RouteMatcher class in vert.x 2.0(how i understood it works like Matcher-class from regex package). Now I need to use something like this construction,but in v. 3.2.1. But I didn't find routmetcher there. What is alternative of?

Tim Fox

unread,
Apr 15, 2016, 6:04:14 AM4/15/16
to ve...@googlegroups.com


On 15/04/16 10:32, Сэм Фишер wrote:
I saw that it was possibly to use RouteMatcher class in vert.x 2.0(how i understood it works like Matcher-class from regex package). Now I need to use something like this construction,but in v. 3.2.1. But I didn't find routmetcher there. What is alternative of?
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/37eb1849-f222-44d2-920d-e28a68f5eedc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Сэм Фишер

unread,
Apr 15, 2016, 8:42:19 AM4/15/16
to vert.x
vertx web is good, but i made sever,using vert.x core. and now i can't create Router,because its constructor doesn't accept vertx instance,because it was created with vertx core. may be exist other solutions?

пятница, 15 апреля 2016 г., 13:04:14 UTC+3 пользователь Tim Fox написал:

Clement Escoffier

unread,
Apr 15, 2016, 8:49:36 AM4/15/16
to ve...@googlegroups.com
Creating a a Router object should accept your vert.x instance. Can you tell us a bit more about your issue. 

It should be something like:

Router router = Router.router(vertx);
// … register your routes …///

vertx.createHttpServer()
    .requestHandler(router::accept)
    .listen(….);

We strongly recommend using vert.x web if you plan to have “sophisticated” REST APIs (as soon as a “startWith" on the path is not enough). 

Clement

Сэм Фишер

unread,
Apr 15, 2016, 9:07:51 AM4/15/16
to vert.x
I have a server which was created with vertx core 2.6.1 and vertx platform 2.6.1. i need to modernize it using vertx 3.2.1. how you understand a already have httpServer and vertx instanceses, but they were created using core-version. now i see in documentation vertx-web example which you wrote.  so,according to documentation, Router class has constructor(we can't create an instance of this class without transmitting a delegate) and we have next situation:

public Router(io.vertx.ext.web.Router delegate) {
this.delegate = delegate;
}

How do we see it accepts only vertex.web delegate. but i created a vertex instance and http server in vertx.core. and in version 2.6.1 i could use routematcher which was included. that is a problem.


пятница, 15 апреля 2016 г., 12:32:21 UTC+3 пользователь Сэм Фишер написал:

Сэм Фишер

unread,
Apr 15, 2016, 10:35:32 AM4/15/16
to vert.x
Looking through Router API, i found such method

public static Router router(Vertx vertx) { 
Router ret= Router.newInstance(io.vertx.ext.web.Router.router((io.vertx.core.Vertx) vertx.getDelegate()));
return ret;
}

maybe it's possible to put   vertx  (vertx.core delegate) in Router's constructor? 

пятница, 15 апреля 2016 г., 16:07:51 UTC+3 пользователь Сэм Фишер написал:

Сэм Фишер

unread,
Apr 15, 2016, 10:44:02 AM4/15/16
to vert.x
I MADE IT =)

In order to put vertx instance, which was created in vertx.core we need to make a cast:

Router router=new Router((io.vertx.ext.web.Router) vertx);

I think now it will be possible to work with this router

пятница, 15 апреля 2016 г., 17:35:32 UTC+3 пользователь Сэм Фишер написал:
Reply all
Reply to author
Forward
0 new messages