The original file name should be stored in the properties of the Nmsg under the key "org.apache.servicemix.file.name". Basically the DefaultFileMarshaler looks for that property and hands it to the sender endpoint in marshaler method "getOutputName".
So you could: A) hand the correct outfile name to the file sender by modifying that property in an endpoint before the file sender B) override the getOutputName method and produce your own naming Regards Lars 2010/8/2 Gary.Jiang <[email protected]>: > > Dear, > > I have got a problem with how to change the filename when I get a file by > sevicemix-file BC.I intended to send a file by poller service and transform > it's content by saxon BC and the get the transformed file by sender service. > And I wanted the file I got displayed as a name I wanted.For example,I > transfer a file named A.xml and I want to get a result file named A.html. > I don't know how to use the file marshaler.The xbean.xml as following: > > <?xml version="1.0" encoding="UTF-8"?> > > <beans xmlns:file="http://servicemix.apache.org/file/1.0" > xmlns="http://www.springframework.org/schema/beans" > xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://servicemix.apache.org/file/1.0 > http://servicemix.apache.org/schema/servicemix-file-3.2.3.xsd > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> > > <file:poller service="file-upload" > endpoint="pollEndpoint" > targetService="file-transfomer" > file="file:///D:/project/FiletestPoller"> > > <!-- Custom Marshaler, if you are not going to poll xml files. > --> > > <!-- > <property name="marshaler"> > <bean > class="org.apache.servicemix.components.util.BinaryFileMarshaler" /> > </property> > --> > </file:poller> > > <file:sender service="file-destination" > endpoint="sendEndpoint" > directory="file:///D:/project/FiletestSender"> > <property name="marshaler"> > <bean > class="org.apache.servicemix.components.util.DefaultFileMarshaler"> > <property name="fileName"> > <bean > class="org.apache.servicemix.expression.JAXPStringXPathExpression"> > <property name="XPath" > value="concat(${fileName},'.html')"/> > </bean> > </property> > </bean> > </property> > </file:sender> > > </beans> > > But I can't get the original file Name. If I define a file name by myself it > would be worked successful. > How can I get the filename? > > Best Regards! > > -- > View this message in context: > http://servicemix.396122.n5.nabble.com/How-to-change-a-filename-In-sevicemix-file-BC-tp2261358p2261358.html > Sent from the ServiceMix - User mailing list archive at Nabble.com. > -- http://lhein.blogspot.com
