From 7924b7d5f95d38b0022e0fdfcab37639c84c88fb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 12 Dec 2016 22:49:10 +0300 Subject: @Controller + @ResponseBody = @RestController --- .../src/main/java/com/juick/api/controllers/Messages.java | 4 ++-- .../src/main/java/com/juick/api/controllers/Notifications.java | 10 ++++++---- juick-api/src/main/java/com/juick/api/controllers/Others.java | 7 ++----- juick-api/src/main/java/com/juick/api/controllers/PM.java | 6 ++---- juick-api/src/main/java/com/juick/api/controllers/Post.java | 5 +---- .../src/main/java/com/juick/api/controllers/Subscriptions.java | 6 ++---- juick-api/src/main/java/com/juick/api/controllers/Tags.java | 6 ++---- .../main/java/com/juick/api/controllers/TelegramWebhook.java | 4 ++-- juick-api/src/main/java/com/juick/api/controllers/Users.java | 6 ++---- 9 files changed, 21 insertions(+), 33 deletions(-) (limited to 'juick-api/src/main/java/com/juick') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index 47053706..75d38c92 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -15,12 +15,12 @@ import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.stanza.model.Message; @@ -31,7 +31,7 @@ import java.util.List; /** * @author ugnich */ -@Controller +@RestController @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public class Messages { private static final Logger logger = LoggerFactory.getLogger(Messages.class); diff --git a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java index 9f2f675b..24cb67f3 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java @@ -15,8 +15,11 @@ import com.juick.service.UserService; import com.juick.util.UserUtils; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; import java.io.IOException; @@ -27,8 +30,7 @@ import java.util.stream.Collectors; /** * Created by vitalyster on 24.10.2016. */ -@Controller -@ResponseBody +@RestController public class Notifications { @Inject diff --git a/juick-api/src/main/java/com/juick/api/controllers/Others.java b/juick-api/src/main/java/com/juick/api/controllers/Others.java index b23be483..722653a5 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Others.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Others.java @@ -8,21 +8,18 @@ import com.juick.service.PMQueriesService; import com.juick.service.UserService; import com.juick.util.UserUtils; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; -import java.security.Principal; import java.util.List; /** * @author ugnich */ -@Controller -@ResponseBody +@RestController public class Others { @Inject PMQueriesService pmQueriesService; diff --git a/juick-api/src/main/java/com/juick/api/controllers/PM.java b/juick-api/src/main/java/com/juick/api/controllers/PM.java index 1bf1646b..9faf05ea 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/PM.java +++ b/juick-api/src/main/java/com/juick/api/controllers/PM.java @@ -9,11 +9,10 @@ import com.juick.service.UserService; import com.juick.util.UserUtils; import com.juick.util.WebUtils; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.stanza.model.Message; @@ -23,8 +22,7 @@ import java.util.List; /** * @author ugnich */ -@Controller -@ResponseBody +@RestController public class PM { @Inject UserService userService; diff --git a/juick-api/src/main/java/com/juick/api/controllers/Post.java b/juick-api/src/main/java/com/juick/api/controllers/Post.java index 72327ad0..606b5e82 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Post.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Post.java @@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import rocks.xmpp.addr.Jid; @@ -33,13 +32,11 @@ import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.security.Principal; /** * Created by vt on 24/11/2016. */ -@Controller -@ResponseBody +@RestController public class Post { private static Logger logger = LoggerFactory.getLogger(ApiServer.class); diff --git a/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java b/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java index 5e8b89b1..fcae3373 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Subscriptions.java @@ -9,11 +9,10 @@ import com.juick.service.SubscriptionService; import com.juick.service.UserService; import com.juick.util.UserUtils; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; import java.io.IOException; @@ -22,8 +21,7 @@ import java.util.List; /** * Created by vitalyster on 24.10.2016. */ -@Controller -@ResponseBody +@RestController public class Subscriptions { @Inject UserService userService; diff --git a/juick-api/src/main/java/com/juick/api/controllers/Tags.java b/juick-api/src/main/java/com/juick/api/controllers/Tags.java index bc412456..7b1ce313 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Tags.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Tags.java @@ -6,11 +6,10 @@ import com.juick.service.TagService; import com.juick.service.UserService; import com.juick.util.UserUtils; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; import java.util.List; @@ -18,8 +17,7 @@ import java.util.List; /** * Created by vitalyster on 29.11.2016. */ -@Controller -@ResponseBody +@RestController public class Tags { @Inject UserService userService; diff --git a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java index ea645390..90929711 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java +++ b/juick-api/src/main/java/com/juick/api/controllers/TelegramWebhook.java @@ -11,10 +11,10 @@ import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; @@ -25,7 +25,7 @@ import java.util.List; /** * Created by vt on 24/11/2016. */ -@Controller +@RestController public class TelegramWebhook { private static Logger logger = LoggerFactory.getLogger(TelegramWebhook.class); @Inject diff --git a/juick-api/src/main/java/com/juick/api/controllers/Users.java b/juick-api/src/main/java/com/juick/api/controllers/Users.java index 079ff4f3..3805b2ef 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Users.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Users.java @@ -7,11 +7,10 @@ import com.juick.service.UserService; import com.juick.util.UserUtils; import com.juick.util.WebUtils; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; import java.util.ArrayList; @@ -20,8 +19,7 @@ import java.util.List; /** * @author ugnich */ -@Controller -@ResponseBody +@RestController public class Users { @Inject UserService userService; -- cgit v1.2.3