Class MissingRequestHeaderException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.bind.ServletRequestBindingException
org.springframework.web.bind.MissingRequestValueException
org.springframework.web.bind.MissingRequestHeaderException
- All Implemented Interfaces:
Serializable, ErrorResponse
ServletRequestBindingException subclass that indicates
that a request header expected in the method parameters of an
@RequestMapping method is not present.- Since:
- 5.1
- Author:
- Juergen Hoeller
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ErrorResponse
ErrorResponse.Builder, ErrorResponse.Interceptor -
Constructor Summary
ConstructorsConstructorDescriptionMissingRequestHeaderException(String headerName, MethodParameter parameter) Constructor for MissingRequestHeaderException.MissingRequestHeaderException(String headerName, MethodParameter parameter, boolean missingAfterConversion) Constructor for use when a value was present but converted tonull. -
Method Summary
Modifier and TypeMethodDescriptionfinal StringReturn the expected name of the request header.final MethodParameterReturn the method parameter bound to the request header.Methods inherited from class MissingRequestValueException
isMissingAfterConversionMethods inherited from class ServletRequestBindingException
getBody, getDetailMessageArguments, getDetailMessageCode, getStatusCodeMethods inherited from class jakarta.servlet.ServletException
getRootCauseMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ErrorResponse
getDetailMessageArguments, getHeaders, getTitleMessageCode, getTypeMessageCode, updateAndGetBody
-
Constructor Details
-
MissingRequestHeaderException
Constructor for MissingRequestHeaderException.- Parameters:
headerName- the name of the missing request headerparameter- the method parameter
-
MissingRequestHeaderException
public MissingRequestHeaderException(String headerName, MethodParameter parameter, boolean missingAfterConversion) Constructor for use when a value was present but converted tonull.- Parameters:
headerName- the name of the missing request headerparameter- the method parametermissingAfterConversion- whether the value became null after conversion- Since:
- 5.3.6
-
-
Method Details
-
getMessage
- Overrides:
getMessagein classThrowable
-
getHeaderName
Return the expected name of the request header. -
getParameter
Return the method parameter bound to the request header.
-