[
https://issues.apache.org/jira/browse/CXF-6082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14196228#comment-14196228
]
Constantino Cronemberger commented on CXF-6082:
-----------------------------------------------
Well, so that the first thing to be fixed is the method getStatusInfo in the
class ResponseImpl because it gets ReasonPhrase after mapping the status code
back to the enum, so even if it was passing this string to setStatus or
sendError it would ignore the string I am trying to send.
> method Response.StatusType.getReasonPhrase is never called by CXF to generate
> a response
> ----------------------------------------------------------------------------------------
>
> Key: CXF-6082
> URL: https://issues.apache.org/jira/browse/CXF-6082
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.0.2
> Reporter: Constantino Cronemberger
>
> I am trying to send a JAX-RS response passing in a custom status code message
> and I found that with CXF this is not possible.
> I checked the code and found that getReasonPhrase is never called and that
> neither HttpServletResponse.setStatus(int i, java.lang.String s) nor
> sendError(int i, java.lang.String s) are used in CXF.
> In fact I found a call to getReasonPhrase in the getStatusInfo of the
> ResposeImpl class, but at the end it is only used by the method
> WebApplicationException.computeExceptionMessage to create the message text of
> the exception, but it would be necessary to call setStatus or sendError
> anyway.
> Looks like this can be done with Jersey:
> http://www.codingpedia.org/ama/custom-reason-phrase-in-http-status-error-message-response-with-jax-rs-jersey
> but I have tested only with CXF.
> The workaround for my case should be simple: instead of generating the
> response with an ExceptionMapper I will create a regular servlet error page
> which will call sendError appropriately.
> I still don't have a clear idea of how I could implement this fix for CXF.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)