diff options
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r-- | src/main/java/com/juick/www/api/Index.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/com/juick/www/api/Index.java b/src/main/java/com/juick/www/api/Index.java index 2d71683e0..46aa65b54 100644 --- a/src/main/java/com/juick/www/api/Index.java +++ b/src/main/java/com/juick/www/api/Index.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2021, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -41,16 +41,19 @@ import java.net.URI; @RestController public class Index { private static final Logger logger = LoggerFactory.getLogger("API"); + @Hidden @RequestMapping(value = { "/api/", "/ws/" }, method = RequestMethod.GET) public ResponseEntity<Void> description() { URI redirectUri = ServletUriComponentsBuilder.fromCurrentRequestUri().path("/swagger-ui.html").build().toUri(); return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(redirectUri).build(); } + @ExceptionHandler(HttpMediaTypeNotAcceptableException.class) public ResponseEntity<String> invalidMediaType(final HttpMediaTypeNotAcceptableException exception, final NativeWebRequest request) { - logger.info("Media type not resolved ({}) for url: {}", request.getHeaderValues("Accept"), ServletUriComponentsBuilder.fromCurrentRequestUri()); + logger.info("Media type not resolved ({}) for url: {}", request.getHeaderValues("Accept"), + ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUriString()); return ResponseEntity.badRequest().body("Invalid media type"); } } |