Author: richard.opalka(a)jboss.com
Date: 2008-07-31 04:45:55 -0400 (Thu, 31 Jul 2008)
New Revision: 7959
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
Log:
[JBWS-2190] propagate encoding to SAAJ properties if charset is specified in Content-Type
MIME header
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2008-07-30
15:13:02 UTC (rev 7958)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/EnvelopeBuilderDOM.java 2008-07-31
08:45:55 UTC (rev 7959)
@@ -82,11 +82,7 @@
try
{
InputSource inputSource = new InputSource(ins);
- String encoding = getEncoding(soapMessage);
- if (encoding != null)
- {
- inputSource.setEncoding(encoding);
- }
+ inputSource.setEncoding(getEncoding(soapMessage));
domEnv = DOMUtils.parse(inputSource);
}
catch (IOException ex)
@@ -109,11 +105,7 @@
try
{
InputSource inputSource = new InputSource( reader );
- String encoding = getEncoding(soapMessage);
- if (encoding != null)
- {
- inputSource.setEncoding(encoding);
- }
+ inputSource.setEncoding(getEncoding(soapMessage));
domEnv = DOMUtils.parse(inputSource);
}
catch (IOException ex)
@@ -131,7 +123,12 @@
private String getEncoding(SOAPMessage soapMessage) throws SOAPException
{
- return (String)soapMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
+ String encoding =
(String)soapMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING);
+ if (encoding == null)
+ {
+ encoding = "UTF-8";
+ }
+ return encoding;
}
public SOAPEnvelope build(SOAPMessage soapMessage, Element domEnv) throws
SOAPException
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2008-07-30
15:13:02 UTC (rev 7958)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/soap/MessageFactoryImpl.java 2008-07-31
08:45:55 UTC (rev 7959)
@@ -215,6 +215,11 @@
log.debug("createMessage: [contentType=" + contentType + "]");
SOAPMessageImpl soapMessage = new SOAPMessageImpl();
+ String encoding = contentType.getParameterList().get("charset");
+ if (encoding != null)
+ {
+ soapMessage.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding);
+ }
if (inputStream != null)
{
// Debug the incoming message