Thanks for all trying to help 🙂
Backround information:
I use the spring framework version 2.4.3 together with Java (and Maven)
To my question:
Is it possible to shorten http://localhost:8080/api/v1/example?admin=true&superPrivilege=true
to something like http://localhost:8080/api/v1/example?admin&superPrivilege
.
So what I want is to use boolean Parameters as Flag.
If the parameter is set then it counts as true if not as False. Is that possible in Spring Boot?
I actually don’t know what to google for because I’m new with any kind of Webdevelopement.
(And jep I did try a couple of hours in the last days xD)
Advertisement
Answer
Another approach could be:
@GetMapping("/demo") public String demo(@RequestParam Map<String, String> parameters) { if (parameters.containsKey("key")) { System.out.println("I has key"); } return "hello"; }