Merge pull request #3 from eugenp/master

Update fork
This commit is contained in:
Shubham Aggarwal 2017-10-29 08:34:51 +05:30 committed by GitHub
commit d873088b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 0 deletions

View File

@ -4,6 +4,8 @@ import com.forketyfork.guest.springmvc.model.LoginData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.Collections;
@ -28,4 +30,10 @@ public class InternalsController {
}
}
@ResponseBody
@PostMapping("/message")
public MyOutputResource sendMessage(@RequestBody MyInputResource inputResource) {
return new MyOutputResource("Received: " + inputResource.getRequestMessage());
}
}

View File

@ -0,0 +1,14 @@
package com.forketyfork.guest.springmvc.web;
public class MyInputResource {
private String requestMessage;
public String getRequestMessage() {
return requestMessage;
}
public void setRequestMessage(String requestMessage) {
this.requestMessage = requestMessage;
}
}

View File

@ -0,0 +1,15 @@
package com.forketyfork.guest.springmvc.web;
public class MyOutputResource {
private String responseMessage;
public MyOutputResource(String responseMessage) {
this.responseMessage = responseMessage;
}
public String getResponseMessage() {
return responseMessage;
}
}

View File

@ -0,0 +1,14 @@
package com.forketyfork.guest.springmvc.web;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class RestfulWebServiceController {
@GetMapping("/message")
public MyOutputResource getMessage() {
return new MyOutputResource("Hello!");
}
}