[jboss-jira] [JBoss JIRA] (JBAS-9529) CXF not correctly escaping >
Kelly Attaway (JIRA)
jira-events at lists.jboss.org
Thu Feb 7 10:41:51 EST 2013
[ https://issues.jboss.org/browse/JBAS-9529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752834#comment-12752834 ]
Kelly Attaway commented on JBAS-9529:
-------------------------------------
Hi Alessio,
Eric opened this ticket on my and my teammates’ behalf, so I thought I’d comment and provide a little more information and answer some of your questions.
We’re seeing this issue in the context of a Jax-WS, and we’re using Jboss 6. The cxf version we are using is 2.5.1 and it is being pulled as a Maven dependency. Unfortunately, we do not have the option of moving to Jboss 7 as you suggest at this point, so we’d really like to find a solution with our current version.
We are attempting to send an XML document in a Soap response as an MTOM attachment, and it is a business requirement that the UTF-8 encoding of the document be maintained through the process and returned unchanged. The desired encoding is set in the XML header (<?xml version="1.0" encoding="UTF-8"?>), and we have attempted to add the specified charset to the @XmlMimeType annotation on the field in question, with no change in behavior.
While debugging through the cxf code, we noticed that a second message response variable is maintained, separate from the one we constructed. This second variable contains exactly our response, with one change: its encoding is set to ISO-8859-1. At some point before we actually return the response, our originally constructed message (UTF-8) is replaced with this newly created and wrongly encoded message (ISO-8859-1). In our web.xml file, however, we have created an encodingFilter (of class org.springframework.web.filter.CharacterEncodingFilter) which sets the encoding to UTF-8. Our response passes through this filter before being returned, so while we do return something UTF-8 encoded, the message has already been altered during the UTF-8 to ISO-8859-1 conversion. During that conversion, some of the XML special characters become unescaped. Specifically, > becomes <, " becomes “, and ' becomes ‘. The other two special XML characters (< and &) remain in their original form, which we consider correct.
Additionally we also tried using the cxf-api jar in the common-/lib folder of jboss instead of getting it from maven, but the result remained unchanged.
In short, we are looking for some way to avoid the UTF-8 to ISO-8859-1 conversion that occurs in the ServiceInvokerInterceptor.handleMessage(Message) entirely. Is there perhaps a configuration we’re missing? All of our searches for one thus far have been fruitless.
Thanks for your time!
> CXF not correctly escaping >
> -------------------------------
>
> Key: JBAS-9529
> URL: https://issues.jboss.org/browse/JBAS-9529
> Project: Application Server 3 4 5 and 6
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Web Services
> Affects Versions: 6.1.0
> Environment: RHEL 5
> Reporter: Eric Schley
> Assignee: Alessio Soldano
>
> We have a string containing &gt; (literally &gt; not >) and we are trying to return it in a response but it is getting converted into >. I would have thought if any escaping occurred it would have possibly converted it to &amp;gt; and then back to &gt;
> We were using encoding of UTF-8. We did notice that if we were using ISO-8859-1 this would occur so we aren't sure if somewhere within its processing it may be defaulting to ISO-8859-1 and then passing it back up.
> using apache CXF 2.5.1
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list