aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-03-24 19:10:37 +0300
committerGravatar Vitaly Takmazov2021-03-24 19:10:37 +0300
commit7f6aa658c287308ebc1ac578e663d2aea5ab1db7 (patch)
treecf174dc63a291e16ee16bee5fd70c9f77559a265 /src/main/java/com/juick/www
parentb73568fe17500765c33f6a062226e6b433412c49 (diff)
Fix url logging in HttpMediaTypeNotAcceptableException handler
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r--src/main/java/com/juick/www/api/Index.java7
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 2d71683e..46aa65b5 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");
}
}