Handling Invalid URLs in Spring Boot Kotlin

29 views Asked by At

I'm working on a Spring Boot Kotlin application where I have an API endpoint /mytasks/check and I've implemented a custom exception handler class RestResponseEntityExceptionHandler which extends AuthenticationFailureHandler, AccessDeniedHandler and ResponseEntityExceptionHandler. This class includes handling for @ExceptionHandler(Throwable::class).

However, I encountered an issue regarding handling invalid URLs. Specifically, when a user adds %% to the API endpoint, such as mytasks/check%%, it results in a 400 Bad Request error.

I'm seeking guidance on how to handle all cases similar to mytasks/check%% effectively to return an appropriate error page within my existing exception handling setup. Should I integrate the handling logic within the existing RestResponseEntityExceptionHandler class, or is there a better approach?

0

There are 0 answers