Skip to content

Instantly share code, notes, and snippets.

@jakubhalun
Created October 9, 2017 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakubhalun/0afc2b5881621ef62577a7a4db7356a8 to your computer and use it in GitHub Desktop.
Save jakubhalun/0afc2b5881621ef62577a7a4db7356a8 to your computer and use it in GitHub Desktop.
RestController for Byte Buddy instrumentation demo
@RestController
public class HelloController {
private static final String template = "Hello, %s!";
@RequestMapping("/hello")
public String greeting(
@RequestParam(value = "name", defaultValue = "World") String name) {
return String.format(template, name);
}
@RequestMapping("/browser")
public String showUserAgent(HttpServletRequest request) {
return request.getHeader("user-agent");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment