Package org.springframework.web.bind
Class MissingPathVariableException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.util.NestedServletException
org.springframework.web.bind.ServletRequestBindingException
org.springframework.web.bind.MissingRequestValueException
org.springframework.web.bind.MissingPathVariableException
- All Implemented Interfaces:
Serializable
,ErrorResponse
ServletRequestBindingException
subclass that indicates that a path
variable expected in the method parameters of an @RequestMapping
method is not present among the URI variables extracted from the URL.
Typically that means the URI template does not match the path variable name
declared on the method parameter.- Since:
- 4.2
- Author:
- Rossen Stoyanchev
- See Also:
-
Constructor Summary
ConstructorDescriptionMissingPathVariableException
(String variableName, MethodParameter parameter) Constructor for MissingPathVariableException.MissingPathVariableException
(String variableName, MethodParameter parameter, boolean missingAfterConversion) Constructor for use when a value was present but converted tonull
. -
Method Summary
Modifier and TypeMethodDescriptionReturn the detail message, including the message from the nested exception if there is one.final MethodParameter
Return the method parameter bound to the path variable.int
Return the HTTP status value for the response, potentially non-standard and not resolvable viaHttpStatus
.final String
Return the expected name of the path variable.Methods inherited from class org.springframework.web.bind.MissingRequestValueException
isMissingAfterConversion
Methods inherited from class org.springframework.web.bind.ServletRequestBindingException
getBody
Methods inherited from class jakarta.servlet.ServletException
getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, 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
getHeaders, getStatus
-
Constructor Details
-
MissingPathVariableException
Constructor for MissingPathVariableException.- Parameters:
variableName
- the name of the missing path variableparameter
- the method parameter
-
MissingPathVariableException
public MissingPathVariableException(String variableName, MethodParameter parameter, boolean missingAfterConversion) Constructor for use when a value was present but converted tonull
.- Parameters:
variableName
- the name of the missing path variableparameter
- the method parametermissingAfterConversion
- whether the value became null after conversion- Since:
- 5.3.6
-
-
Method Details
-
getMessage
Description copied from class:NestedServletException
Return the detail message, including the message from the nested exception if there is one.- Overrides:
getMessage
in classNestedServletException
-
getVariableName
Return the expected name of the path variable. -
getParameter
Return the method parameter bound to the path variable. -
getRawStatusCode
public int getRawStatusCode()Description copied from interface:ErrorResponse
Return the HTTP status value for the response, potentially non-standard and not resolvable viaHttpStatus
.- Specified by:
getRawStatusCode
in interfaceErrorResponse
- Overrides:
getRawStatusCode
in classServletRequestBindingException
-