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 37F8A1034E for ; Thu, 27 Mar 2014 15:45:39 +0000 (UTC) Received: (qmail 31374 invoked by uid 500); 27 Mar 2014 15:45:35 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 31243 invoked by uid 500); 27 Mar 2014 15:45:31 -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 29804 invoked by uid 99); 27 Mar 2014 15:45:23 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 15:45:23 +0000 Date: Thu, 27 Mar 2014 15:45:23 +0000 (UTC) From: "Sergey Beryozkin (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (CXF-5656) ContentType is removed for InternalServerError and doesn't seem to be a way to set a charset 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-5656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13949466#comment-13949466 ] Sergey Beryozkin edited comment on CXF-5656 at 3/27/14 3:44 PM: ---------------------------------------------------------------- This code was added more than 3 years ago and I guess it is difficult now to know why. I think it can be safely removed, there's no reason why Content-Type should be stripped off its parameters in case of 500... was (Author: sergey_beryozkin): This code was added more than 3 years ago and I guess it is difficult now to know why. I think it can be safely removed, there's no reason why Content-Type should be stripped of its parameters in case of 500... > ContentType is removed for InternalServerError and doesn't seem to be a way to set a charset > -------------------------------------------------------------------------------------------- > > Key: CXF-5656 > URL: https://issues.apache.org/jira/browse/CXF-5656 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 2.7.7, 2.7.10 > Reporter: Andy Kane > > We have a Rest service that uses JAX-RS and CXF. When we used CXF 2.3.3, if there was a problem with the request and a non 200 status code was returned, the browser would display the message from the response with any encoded non ASCII characters as the ContentType returned application/json;charset=utf-8. > After upgrading to 2.7.7, we noticed that non ASCII characters where not being encoded for Status 500 - Internal Server Error. This doesn't happen for any other status codes and we noticed that charset=utf-8 was being stripped from the ContentType. After looking through the CXF code, I noticed that the AbstractHTTPDestination class was removing the ContentType (line 553). The ContentType was then re-added in getContentTypeFromMessage method in the headers object without the Charset. Looking at this method, I noticed that the encoding was taken from Message.ENCODING and in our case this was null. > There doesn't seem to be a way of setting org.apache.cxf.message.Message.ENCODING from either the ExceptionMapper or ExceptionMapper. I have also set the encoding type in the Response object in ExceptionMapper, but this doesn't seem to make much difference either. > Removing the ContentType seems like a bug, as if the ContentType has been previously set and then this should be preserved. Is there a work around for this problem in the mean time. -- This message was sent by Atlassian JIRA (v6.2#6252)