#39 fix issue /user/image/1 - produces 404 without appropriate HttpResponse message
This commit is contained in:
@ -16,6 +16,7 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
|
|||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||||
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
import javax.persistence.NoResultException;
|
import javax.persistence.NoResultException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -83,10 +84,10 @@ public class ExceptionHandling {
|
|||||||
return createHttpResponse(METHOD_NOT_ALLOWED, String.format(METHOD_IS_NOT_ALLOWED, supportedMethod));
|
return createHttpResponse(METHOD_NOT_ALLOWED, String.format(METHOD_IS_NOT_ALLOWED, supportedMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ExceptionHandler(NoHandlerFoundException.class)
|
@ExceptionHandler(NoHandlerFoundException.class)
|
||||||
// public ResponseEntity<HttpResponse> noHandlerFoundException(NoHandlerFoundException exception) {
|
public ResponseEntity<HttpResponse> noHandlerFoundException(NoHandlerFoundException exception) {
|
||||||
// return createHttpResponse(BAD_REQUEST, "This page was not found");
|
return createHttpResponse(NOT_FOUND, "Resource not found");
|
||||||
// }
|
}
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
@ExceptionHandler(Exception.class)
|
||||||
public ResponseEntity<HttpResponse> internalServerErrorException(Exception exception) {
|
public ResponseEntity<HttpResponse> internalServerErrorException(Exception exception) {
|
||||||
|
|||||||
@ -34,11 +34,11 @@ spring:
|
|||||||
max-file-size: 10MB
|
max-file-size: 10MB
|
||||||
max-request-size: 100MB
|
max-request-size: 100MB
|
||||||
|
|
||||||
# mvc:
|
mvc:
|
||||||
# throw-exception-if-no-handler-found: true
|
throw-exception-if-no-handler-found: true
|
||||||
# web:
|
web:
|
||||||
# resources:
|
resources:
|
||||||
# add-mappings: false
|
add-mappings: false
|
||||||
app:
|
app:
|
||||||
public-urls: /user/login,/user/register,/user/*/image/**,/user/image/**
|
public-urls: /user/login,/user/register,/user/*/image/**,/user/image/**
|
||||||
cors:
|
cors:
|
||||||
|
|||||||
Reference in New Issue
Block a user