Class NoResourceFoundException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.servlet.resource.NoResourceFoundException
- All Implemented Interfaces:
- Serializable, ErrorResponse
public class NoResourceFoundException
extends jakarta.servlet.ServletException
implements ErrorResponse
Raised when 
ResourceHttpRequestHandler can not find a resource.- Since:
- 6.1
- Author:
- Rossen Stoyanchev
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface ErrorResponseErrorResponse.Builder, ErrorResponse.Interceptor
- 
Constructor SummaryConstructorsConstructorDescriptionNoResourceFoundException(HttpMethod httpMethod, String requestUri, String resourcePath) Create an instance.
- 
Method SummaryModifier and TypeMethodDescriptiongetBody()Return the body for the response, formatted as an RFC 9457ProblemDetailwhosestatusshould match the response status.Return the HTTP method for the request.Return the path used to locate the resource.Return the HTTP status code to use for the response.Methods inherited from class jakarta.servlet.ServletExceptiongetRootCauseMethods inherited from class ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ErrorResponsegetDetailMessageArguments, getDetailMessageArguments, getDetailMessageCode, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody
- 
Constructor Details- 
NoResourceFoundExceptionCreate an instance.
 
- 
- 
Method Details- 
getHttpMethodReturn the HTTP method for the request.
- 
getResourcePath
- 
getStatusCodeDescription copied from interface:ErrorResponseReturn the HTTP status code to use for the response.- Specified by:
- getStatusCodein interface- ErrorResponse
 
- 
getBodyDescription copied from interface:ErrorResponseReturn the body for the response, formatted as an RFC 9457ProblemDetailwhosestatusshould match the response status.Note: The returned ProblemDetailmay be updated before the response is rendered, for example, viaErrorResponse.updateAndGetBody(MessageSource, Locale). Therefore, implementing methods should use an instance field, and should not re-create theProblemDetailon every call, nor use a static variable.- Specified by:
- getBodyin interface- ErrorResponse
 
 
-