diff options
author | Vitaly Takmazov | 2021-10-30 05:08:45 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2021-10-30 05:16:54 +0300 |
commit | cedf00d682ef0b62e291f9fec9946162bcdc098e (patch) | |
tree | 06f063cf601646b5fa8f90829992c0a24ade3137 /src/main/java/com/juick/www/rss/Feeds.java | |
parent | b510c139c7b0931c1e17aeaf13b92488f4da1fd1 (diff) |
Handle wrong RSS path correctly
Diffstat (limited to 'src/main/java/com/juick/www/rss/Feeds.java')
-rw-r--r-- | src/main/java/com/juick/www/rss/Feeds.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/com/juick/www/rss/Feeds.java b/src/main/java/com/juick/www/rss/Feeds.java index 4423b263..8111f2df 100644 --- a/src/main/java/com/juick/www/rss/Feeds.java +++ b/src/main/java/com/juick/www/rss/Feeds.java @@ -22,7 +22,12 @@ import com.juick.util.HttpNotFoundException; import com.juick.service.MessagesService; import com.juick.service.UserService; import com.juick.service.security.annotation.Visitor; + +import org.springframework.core.convert.ConversionFailedException; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; @@ -79,4 +84,9 @@ public class Feeds { modelAndView.addObject("messages", messagesService.getLastReplies(hours)); return modelAndView; } + // wrong feed type + @ExceptionHandler(ConversionFailedException.class) + public ResponseEntity<String> notFoundAction() { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } } |