router.get("/somePath")
.handler(this::doV1);
public void doV1(RoutingContext rc) {
MultiMap queryParams = rc.request().params();
String param1 = map.get("param1");
rc.response().end();
router.get("/somePath?command=ABC").handler(this::myABCHandler);
router.get("/somePath?command=XYZ").handler(this::myXYZHandler);
router.get("/somePath?command=ABC").handler....
if (params["x"]==y) {
so something
} else if (params["x"]==z) {
do something...
} else {
do default
}
Think of query params as implicit. And path params such as /somepath/:somevalue as explicit.
If you want to hardcode /somepath?command=xyz might as well just use path params.
And honestly defining a bunch of routes mapped to specific query params values, is no sexier than if else or switch.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/081baf81-e38f-433f-a803-e8f84daea561%40googlegroups.com.--
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+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
--
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.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/8bfefc4b-eb69-4e26-9c7a-288014f10680%40googlegroups.com.
and hardcoded query param routing is that what happens if you have two values in the same query parameter for example? This is legitimate according to HTTP spec - which handler do you route to?