You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2008/06/12 23:35:59 UTC
svn commit: r667240 -
/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java
Author: veithen
Date: Thu Jun 12 14:35:59 2008
New Revision: 667240
URL: http://svn.apache.org/viewvc?rev=667240&view=rev
Log:
Set the CHARACTER_SET_ENCODING property in VFSTransportListener as SOAPBuilder relies on this.
Modified:
synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java
Modified: synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java?rev=667240&r1=667239&r2=667240&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java (original)
+++ synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java Thu Jun 12 14:35:59 2008
@@ -34,6 +34,8 @@
import org.apache.commons.vfs.*;
import org.apache.commons.vfs.impl.StandardFileSystemManager;
+import javax.mail.internet.ContentType;
+import javax.mail.internet.ParseException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -380,6 +382,8 @@
String messageId = filePath + "_" + fileName +
"_" + System.currentTimeMillis() + "_" + (int) Math.random() * 1000;
+ MessageContext msgContext = createMessageContext();
+
String contentType = entry.getContentType();
if (BaseUtils.isBlank(contentType)) {
if (file.getName().getExtension().toLowerCase().endsWith(".xml")) {
@@ -387,6 +391,18 @@
} else if (file.getName().getExtension().toLowerCase().endsWith(".txt")) {
contentType = "text/plain";
}
+ } else {
+ // Extract the charset encoding from the configured content type and
+ // set the CHARACTER_SET_ENCODING property as e.g. SOAPBuilder relies on this.
+ String charSetEnc = null;
+ try {
+ if (contentType != null) {
+ charSetEnc = new ContentType(contentType).getParameter("charset");
+ }
+ } catch (ParseException ex) {
+ // ignore
+ }
+ msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
}
// if the content type was not found, but the service defined it.. use it
@@ -400,7 +416,6 @@
}
}
- MessageContext msgContext = createMessageContext();
// set to bypass dispatching if we know the service - we already should!
AxisService service = cfgCtx.getAxisConfiguration().getService(entry.getServiceName());
msgContext.setAxisService(service);