Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 485B610878 for ; Tue, 4 Nov 2014 15:27:35 +0000 (UTC) Received: (qmail 52170 invoked by uid 500); 4 Nov 2014 15:27:34 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 52041 invoked by uid 500); 4 Nov 2014 15:27:34 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 51778 invoked by uid 99); 4 Nov 2014 15:27:33 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Nov 2014 15:27:33 +0000 Date: Tue, 4 Nov 2014 15:27:33 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CXF-6082) method Response.StatusType.getReasonPhrase is never called by CXF to generate a response MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-6082?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14196226#comment-14196226 ] Sergey Beryozkin commented on CXF-6082: --------------------------------------- See: https://java.net/jira/browse/JAX_RS_SPEC-464 Jersey does not do it the portable way for sure... Just do Response.status(myStatus).entity(errorMessage).type("text/plain").build() and it will do it > 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)