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
Raised when
ResourceHttpRequestHandler
can not find a resource.- Since:
- 6.1
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.web.ErrorResponse
ErrorResponse.Builder
-
Constructor Summary
ConstructorDescriptionNoResourceFoundException
(HttpMethod httpMethod, String resourcePath) Create an instance. -
Method Summary
Modifier and TypeMethodDescriptiongetBody()
Return the body for the response, formatted as an RFC 9457ProblemDetail
whosestatus
should 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.ServletException
getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.web.ErrorResponse
getDetailMessageArguments, getDetailMessageArguments, getDetailMessageCode, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody
-
Constructor Details
-
NoResourceFoundException
Create an instance.
-
-
Method Details
-
getHttpMethod
Return the HTTP method for the request. -
getResourcePath
Return the path used to locate the resource. -
getStatusCode
Description copied from interface:ErrorResponse
Return the HTTP status code to use for the response.- Specified by:
getStatusCode
in interfaceErrorResponse
-
getBody
Description copied from interface:ErrorResponse
Return the body for the response, formatted as an RFC 9457ProblemDetail
whosestatus
should match the response status.Note: The returned
ProblemDetail
may be updated before the response is rendered, e.g. viaErrorResponse.updateAndGetBody(MessageSource, Locale)
. Therefore, implementing methods should use an instance field, and should not re-create theProblemDetail
on every call, nor use a static variable.- Specified by:
getBody
in interfaceErrorResponse
-