January 2019
Intermediate to advanced
378 pages
11h 35m
English
The other simple method for implementing the version reference is to make it part of the request parameters, as we see in the following examples—http://localhost:9090/investors?version=1, http://localhost:9090/investors?version=2.1.0:
@GetMapping("/investors")public List<Investor> fetchAllInvestorsForGivenVersionAsParameter(@RequestParam("version") String version)throws VersionNotSupportedException {if (!(version.equals("1.1") || version.equals("1.0"))) {throw new VersionNotSupportedException("version " + version);}return investorService.fetchAllInvestors();}
The output of this is as follows:

The preceding ...
Read now
Unlock full access