Package org.springframework.web
Interface ErrorResponse.Builder
- Enclosing interface:
- ErrorResponse
public static interface ErrorResponse.Builder
Builder for an
ErrorResponse
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build theErrorResponse
instance.Set the underlyingProblemDetail.setDetail(String)
.detailMessageArguments
(Object... messageArguments) Set the arguments to provide to theMessageSource
lookup fordetailMessageCode(String)
.detailMessageCode
(String messageCode) Customize theMessageSource
code for looking up the value for the underlyingdetail(String)
.Add the given header value(s) under the given name.headers
(Consumer<HttpHeaders> headersConsumer) Manipulate this response's headers with the given consumer.Set the underlyingProblemDetail.setInstance(URI)
field.Set a "dynamic"property
on the underlyingProblemDetail
.Set the underlyingProblemDetail.setTitle(String)
field.titleMessageCode
(String messageCode) Customize theMessageSource
code for looking up the value for the underlyingProblemDetail.setTitle(String)
.Set the underlyingProblemDetail.setTitle(String)
field.
-
Method Details
-
header
Add the given header value(s) under the given name.- Parameters:
headerName
- the header nameheaderValues
- the header value(s)- Returns:
- the same builder instance
- See Also:
-
headers
Manipulate this response's headers with the given consumer. This is useful to overwrite or remove existing values, or use any otherHttpHeaders
methods.- Parameters:
headersConsumer
- a function that consumes theHttpHeaders
- Returns:
- the same builder instance
-
detail
Set the underlyingProblemDetail.setDetail(String)
.- Returns:
- the same builder instance
-
detailMessageCode
Customize theMessageSource
code for looking up the value for the underlyingdetail(String)
.By default, this is set to
ErrorResponse.getDefaultDetailMessageCode(Class, String)
with the associated Exception type.- Parameters:
messageCode
- the message code to use- Returns:
- the same builder instance
- See Also:
-
detailMessageArguments
Set the arguments to provide to theMessageSource
lookup fordetailMessageCode(String)
.- Parameters:
messageArguments
- the arguments to provide- Returns:
- the same builder instance
- See Also:
-
type
Set the underlyingProblemDetail.setTitle(String)
field.- Returns:
- the same builder instance
-
title
Set the underlyingProblemDetail.setTitle(String)
field.- Returns:
- the same builder instance
-
titleMessageCode
Customize theMessageSource
code for looking up the value for the underlyingProblemDetail.setTitle(String)
.By default, set via
ErrorResponse.getDefaultTitleMessageCode(Class)
with the associated Exception type.- Parameters:
messageCode
- the message code to use- Returns:
- the same builder instance
- See Also:
-
instance
Set the underlyingProblemDetail.setInstance(URI)
field.- Returns:
- the same builder instance
-
property
Set a "dynamic"property
on the underlyingProblemDetail
.- Returns:
- the same builder instance
-
build
ErrorResponse build()Build theErrorResponse
instance.
-