Top Description Fields Constructors Methods
org.springframework.web.servlet.resource

public Class NoResourceFoundException

extends ServletException
implements ErrorResponse
Class Inheritance
All Implemented Interfaces
org.springframework.web.ErrorResponse
Annotations
@SuppressWarnings:serial
Imports
jakarta.servlet.ServletException, org.springframework.http.HttpMethod, .HttpStatus, .HttpStatusCode, .ProblemDetail, org.springframework.web.ErrorResponse

Raised when ResourceHttpRequestHandler can not find a resource.
Author
Rossen Stoyanchev
Since
6.1
See Also
org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler, org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver

Field Summary

Modifier and TypeField and Description
private final ProblemDetail
private final HttpMethod
private final String

Constructor Summary

AccessConstructor and Description
public
NoResourceFoundException(HttpMethod httpMethod, String resourcePath)

Create an instance.

Method Summary

Modifier and TypeMethod and Description
public ProblemDetail
getBody()

Implements org.springframework.web.ErrorResponse.getBody.

Return the body for the response, formatted as an RFC 7807 ProblemDetail whose status should match the response status.

public HttpMethod
getHttpMethod()

Return the HTTP method for the request.

public String
getResourcePath()

Return the path used to locate the resource.

public HttpStatusCode
getStatusCode()

Implements org.springframework.web.ErrorResponse.getStatusCode.

Return the HTTP status code to use for the response.

Inherited from jakarta.servlet.ServletException:
getRootCause

Field Detail

bodyback to summary
private final ProblemDetail body
httpMethodback to summary
private final HttpMethod httpMethod
resourcePathback to summary
private final String resourcePath

Constructor Detail

NoResourceFoundExceptionback to summary
public NoResourceFoundException(HttpMethod httpMethod, String resourcePath)

Create an instance.

Method Detail

getBodyback to summary
public ProblemDetail getBody()

Implements org.springframework.web.ErrorResponse.getBody.

Doc from org.springframework.web.ErrorResponse.getBody.

Return the body for the response, formatted as an RFC 7807 ProblemDetail whose status should match the response status.

Annotations
@Override
getHttpMethodback to summary
public HttpMethod getHttpMethod()

Return the HTTP method for the request.

getResourcePathback to summary
public String getResourcePath()

Return the path used to locate the resource.

See Also
org.springframework.web.servlet.HandlerMapping#PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
getStatusCodeback to summary
public HttpStatusCode getStatusCode()

Implements org.springframework.web.ErrorResponse.getStatusCode.

Doc from org.springframework.web.ErrorResponse.getStatusCode.

Return the HTTP status code to use for the response.

Annotations
@Override