From d3648888eaea9904fb3b806d56b22827c7614f54 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 21 Oct 2019 12:35:39 +0300 Subject: Spring Boot 2.2 --- src/main/java/com/juick/server/api/Messages.java | 2 +- src/main/java/com/juick/server/api/Notifications.java | 12 ++++++------ src/main/java/com/juick/server/api/PM.java | 6 +++--- src/main/java/com/juick/server/api/Post.java | 4 ++-- src/main/java/com/juick/server/api/Tags.java | 2 +- src/main/java/com/juick/server/api/Users.java | 8 ++++---- src/main/java/com/juick/server/api/activity/Profile.java | 2 +- src/main/resources/application.properties | 1 + 8 files changed, 19 insertions(+), 18 deletions(-) (limited to 'src/main') diff --git a/src/main/java/com/juick/server/api/Messages.java b/src/main/java/com/juick/server/api/Messages.java index 1c9e37ad..f7b8c156 100644 --- a/src/main/java/com/juick/server/api/Messages.java +++ b/src/main/java/com/juick/server/api/Messages.java @@ -49,7 +49,7 @@ import java.util.stream.Collectors; * @author ugnich */ @RestController -@RequestMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE) +@RequestMapping(produces = MediaType.APPLICATION_JSON_VALUE) public class Messages { private static final ResponseEntity> NOT_FOUND = ResponseEntity diff --git a/src/main/java/com/juick/server/api/Notifications.java b/src/main/java/com/juick/server/api/Notifications.java index f2c2d712..72988298 100644 --- a/src/main/java/com/juick/server/api/Notifications.java +++ b/src/main/java/com/juick/server/api/Notifications.java @@ -84,7 +84,7 @@ public class Notifications { } @ApiIgnore - @RequestMapping(value = "/api/notifications", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/notifications", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity> doGet( @Visitor User visitor, @RequestParam(required = false, defaultValue = "0") int uid, @@ -119,7 +119,7 @@ public class Notifications { } @ApiIgnore - @RequestMapping(value = "/api/notifications", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/notifications", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity doDelete( @Visitor User visitor, @RequestBody List list) { @@ -145,7 +145,7 @@ public class Notifications { return ResponseEntity.ok(Status.OK); } @ApiIgnore - @RequestMapping(value = "/api/notifications/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/notifications/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity doDeleteTokens( @Visitor User visitor, @RequestBody List list) { @@ -172,7 +172,7 @@ public class Notifications { } @ApiIgnore - @RequestMapping(value = "/api/notifications", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/notifications", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) public Status doPut( @Visitor User visitor, @RequestBody List list) throws IOException { @@ -195,7 +195,7 @@ public class Notifications { } @Deprecated - @RequestMapping(value = "/api/android/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/android/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Status doAndroidRegister( @Visitor User visitor, @RequestParam(name = "regid") String regId) { @@ -204,7 +204,7 @@ public class Notifications { } @Deprecated - @RequestMapping(value = "/api/winphone/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/winphone/register", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Status doWinphoneRegister( @Visitor User visitor, @RequestParam(name = "url") String regId) { diff --git a/src/main/java/com/juick/server/api/PM.java b/src/main/java/com/juick/server/api/PM.java index 4a408dce..6e6cdcac 100644 --- a/src/main/java/com/juick/server/api/PM.java +++ b/src/main/java/com/juick/server/api/PM.java @@ -55,7 +55,7 @@ public class PM { @Inject private WebApp webApp; - @RequestMapping(value = "/api/pm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/pm", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List doGetPM( @Visitor User visitor, @RequestParam(required = false) String uname) { @@ -73,7 +73,7 @@ public class PM { return msgs; } - @RequestMapping(value = "/api/pm", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/pm", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public com.juick.Message doPostPM( @Visitor User visitor, @RequestParam String uname, @@ -105,7 +105,7 @@ public class PM { } throw new HttpBadRequestException(); } - @RequestMapping(value = "/api/groups_pms", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/groups_pms", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public PrivateChats doGetGroupsPMs( @Visitor User visitor, @RequestParam(defaultValue = "5") int cnt) { diff --git a/src/main/java/com/juick/server/api/Post.java b/src/main/java/com/juick/server/api/Post.java index 10e19faf..59bd05a7 100644 --- a/src/main/java/com/juick/server/api/Post.java +++ b/src/main/java/com/juick/server/api/Post.java @@ -67,7 +67,7 @@ public class Post { @Inject CommandsManager commandsManager; - @RequestMapping(value = "/api/post", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/post", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(value = HttpStatus.OK) public CommandResult doPostMessage( @Visitor User visitor, @@ -99,7 +99,7 @@ public class Post { return commandsManager.processCommand(visitor, body, attachmentFName); } - @RequestMapping(value = "/api/comment", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/comment", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public CommandResult doPostComment( @Visitor User visitor, @RequestParam(defaultValue = "0") int mid, diff --git a/src/main/java/com/juick/server/api/Tags.java b/src/main/java/com/juick/server/api/Tags.java index 35f2bc66..2862d883 100644 --- a/src/main/java/com/juick/server/api/Tags.java +++ b/src/main/java/com/juick/server/api/Tags.java @@ -38,7 +38,7 @@ public class Tags { @Inject private TagService tagService; - @RequestMapping(value = "/api/tags", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/tags", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List tags( @Visitor User visitor, @RequestParam(required = false, defaultValue = "0") int user_id diff --git a/src/main/java/com/juick/server/api/Users.java b/src/main/java/com/juick/server/api/Users.java index 74a720d4..6d7c7a45 100644 --- a/src/main/java/com/juick/server/api/Users.java +++ b/src/main/java/com/juick/server/api/Users.java @@ -81,12 +81,12 @@ public class Users { @Inject private EmailManager emailManager; - @RequestMapping(value = "/api/auth", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/auth", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public String getAuthToken(@Visitor User visitor) { return userService.getHashByUID(visitor.getUid()); } - @RequestMapping(value = "/api/users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/users", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List doGetUsers( @Visitor User visitor, @RequestParam(value = "uname", required = false) List unames) { @@ -190,7 +190,7 @@ public class Users { } } - @RequestMapping(value = "/api/users/read", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/users/read", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List doGetUserRead( @Visitor User visitor, @RequestParam String uname) { @@ -214,7 +214,7 @@ public class Users { throw new HttpNotFoundException(); } - @RequestMapping(value = "/api/users/readers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(value = "/api/users/readers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List doGetUserReaders( @Visitor User visitor, @RequestParam String uname) { diff --git a/src/main/java/com/juick/server/api/activity/Profile.java b/src/main/java/com/juick/server/api/activity/Profile.java index 77945d6b..88c76a93 100644 --- a/src/main/java/com/juick/server/api/activity/Profile.java +++ b/src/main/java/com/juick/server/api/activity/Profile.java @@ -388,7 +388,7 @@ public class Profile { } return new ResponseEntity<>(CommandResult.fromString("Can not authenticate"), HttpStatus.UNAUTHORIZED); } - @PostMapping(value = "/u/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @PostMapping(value = "/u/", produces = MediaType.APPLICATION_JSON_VALUE) public User fetchUser(@RequestParam URI uri) { return activityPubManager.personToUser(uri); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e89670fa..e9d9b77f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,3 +3,4 @@ spring.jackson.default-property-inclusion=non_default spring.jackson.serialization.write-dates-as-timestamps=false spring.h2.console.enabled=true spring.datasource.platform=h2 +spring.http.encoding.force=true -- cgit v1.2.3