Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package defaultpackage.topic;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.Arrays;
- import java.util.List;
- /**
- * Created by zales on 02.03.2017.
- */
- @RestController
- public class TopicController {
- @Autowired
- private TopicService topicService;
- @RequestMapping("/topics")
- public List<Topic> getAllTopics(){
- return topicService.getAllTopics();
- }
- @RequestMapping("/topics/{id}")
- public Topic getTopic(@PathVariable String id){
- return topicService.getTopic(id);
- }
- @RequestMapping(method = RequestMethod.POST, value = "/topics")
- public void addTopic(@RequestBody Topic topic){
- topicService.addTopic(topic);
- }
- @RequestMapping(method = RequestMethod.PUT, value = "/topics/{id}")
- public void updateTopic(@RequestBody Topic topic, @PathVariable String id){
- topicService.updateTopic(id, topic);
- }
- @RequestMapping(method = RequestMethod.DELETE, value = "/topics/{id}")
- public void deleteTopic(@PathVariable String id){
- topicService.deleteTopic(id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement