Is it OK that AbstractBuiltResponse
effectively ignores provided reasonPhrase
?
#2947
Unanswered
jakubzytka
asked this question in
Q&A
Replies: 1 comment 1 reply
-
This seems a bit odd to me as well. It looks like it was introduced in RESTEASY-1991, #1835. @rsearls this was a while ago, but do you recall if there was a reason for this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Please bear with me if this was clarified gazillion times already...
Consider the following (minimized for brevity):
this is due to:
resteasy/resteasy-core/src/main/java/org/jboss/resteasy/specimpl/AbstractBuiltResponse.java
Lines 132 to 160 in 1cca43b
I.e. the provided
reasonPhrase
is ignored when a status code is defined as a "commonly used" one byjavax.ws.rs.core.Response.Status
.Is it OK? It is surprising and the code itself looks like conflicting decisions had been made:
AbstractBuiltResponse
is happy to ignore itpublic String AbstractBuiltResponse::getReasonPhrase()
method, but the reason phrase is really a property of the status info (StatusType
)AbstractBuiltResponse
ignores the reason phrase when aStatus
with the same status code is defined in an enumStatus
. This enum looks more like an entity for convenience (it's a non-exhaustive list of common statuses), and which, potentially, can be extended at any time, breaking backward compatibility (reason phrase disappears for some newly added enum value)Beta Was this translation helpful? Give feedback.
All reactions