Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestController
- public class TestServlet {
- @RequestMapping(value = "/test1")
- public String test1() {
- return "test1";
- }
- @RequestMapping(value = "/test2")
- public String test2(@RequestBody TestClass req) {
- return "test2";
- }
- public static class TestClass {
- private String value;
- public String getValue() {
- return value;
- }
- public void setValue(String value) {
- this.value = value;
- }
- }
- }
- public String test2(@Valid TestClass req) {
- return "test2";
- }
- Content-Type: application/json
- Accept: text/html (As your method returns only a String)
- {
- "value":"the provided value"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement