Skip to content

Instantly share code, notes, and snippets.

@vladdedita
Created November 29, 2023 09:16
Show Gist options
  • Save vladdedita/3b8e6926fc64b73a1fb05b56b1beff33 to your computer and use it in GitHub Desktop.
Save vladdedita/3b8e6926fc64b73a1fb05b56b1beff33 to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("/coffees")
public class CoffeeController {
@GetMapping("/{criteria}/details/{details}/reviews")
public String getCoffeeDetailsAndReviews(@MatrixVariable(pathVar = "criteria") Map<String, String> criteriaMatrixVars,
@MatrixVariable(pathVar = "details") Map<String, String> detailsMatrixVars) {
String roast = criteriaMatrixVars.get("roast");
String origin = criteriaMatrixVars.get("origin");
String flavor = criteriaMatrixVars.get("flavor");
String brand = detailsMatrixVars.get("brand");
return "Fetching details and reviews for " + roast + " roast coffee from " + origin + " with " + flavor + " flavor, brand: " + brand + ".";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment