[ 
https://issues.apache.org/jira/browse/CXF-8234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17058072#comment-17058072
 ] 

Edwin commented on CXF-8234:
----------------------------

[~coheigea] Thank you very much.  My apologies, all along I have meant to refer 
to the issue in StaxOutInterceptor and instead by mistake I have been referring 
to TransformOutInterceptor.  If you check the first few lines of 
'handleMessage' in StaxOutInterceptor which is as follows

 
{code:java}
OutputStream os = message.getContent(OutputStream.class);
XMLStreamWriter xwriter = message.getContent(XMLStreamWriter.class);
Writer writer = null;
if (os == null) {            
    writer = message.getContent(Writer.class);        
}        
if ((os == null && writer == null) || xwriter != null) {            
    return;        
}

String encoding = getEncoding(message);
{code}
 

 

As indicated, when an 'xwriter' is available on the message, then there is a 
return and the 'getEncoding(message)' method is never called to set the 
encoding in the message.  I believe this is the root cause of the issue.

> Response Content-Type is missing 'charset' when Transformation feature is 
> enabled
> ---------------------------------------------------------------------------------
>
>                 Key: CXF-8234
>                 URL: https://issues.apache.org/jira/browse/CXF-8234
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 3.2.6, 3.2.12
>            Reporter: Edwin
>            Priority: Major
>             Fix For: 3.3.6, 3.2.13
>
>
> We have a JAXWS based service and we enabled the transformation feature based 
> on [https://cxf.apache.org/docs/transformationfeature.html], but then we 
> noticed that 'charset' is missing in response Content-Type.  This is probably 
> due to "disable.outputstream.optimization" being set to true by 
> TransformOutInterceptor but the documentation states that 
> "disable.outputstream.optimization" needs to be set to true prior to CXF 
> versions 3.2.6 and 3.1.17.
> We are using 3.2.6 and we even upgraded to 3.2.12 and the behavior is the 
> same.  I also checked TransformOutInterceptor in master branch and it is 
> still setting "disable.outputstream.optimization" to true.
> Is there a workaround for this issue in 3.2.x branch and can this be fixed in 
> future releases?
>  
> Here are part of the headers with transformation:
> {code:java}
> HTTP/1.1 200 
> Content-Type: text/xml
> Transfer-Encoding: chunked
> Date: Sun, 08 Mar 2020 22:41:04 GMT{code}
>  
> And here are part of the headers when transformation is not used:
> {code:java}
> HTTP/1.1 200 
> Content-Type: text/xml;charset=UTF-8
> Transfer-Encoding: chunked
> Date: Sun, 08 Mar 2020 22:40:43 GMT
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to