简体   繁体   中英

How do we implement q Params in Helidon SE

I am new to Helidon SE and would like to know if there is a way to implement q params in REST service created via Helidon SE. Any help in this regard is truly appreciated.

Thanks, Gaurav

If you want to use and read params in the following way eg

http://localhost:8080/?q=test&k=test2

Then -in case of Helidon SE- do the following to get those parameters:

private void getParam(ServerRequest request, ServerResponse response) {

    Map params = request.queryParams().toMap();
    logger.info("params: " + params);
    logger.info("q: " + params.get("q"));
    logger.info("k: " + params.get("k"));
    
    ...

}

Obviously the getParam method is configured for "/" path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM