INT-712 Headers defined by 'header-enricher' elements are now configured as sub-elements rather than attributes. This applies to the "core" as well as the JMS and Mail namespace support.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import org.springframework.integration.config.xml.HeaderEnricherParserSupport;
|
||||
import org.springframework.integration.mail.MailHeaders;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MailHeaderEnricherParser extends HeaderEnricherParserSupport {
|
||||
|
||||
public MailHeaderEnricherParser() {
|
||||
this.addElementToHeaderMapping("subject", MailHeaders.SUBJECT);
|
||||
this.addElementToHeaderMapping("to", MailHeaders.TO);
|
||||
this.addElementToHeaderMapping("cc", MailHeaders.CC);
|
||||
this.addElementToHeaderMapping("bcc", MailHeaders.BCC);
|
||||
this.addElementToHeaderMapping("from", MailHeaders.FROM);
|
||||
this.addElementToHeaderMapping("reply-to", MailHeaders.REPLY_TO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,8 +17,6 @@
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
|
||||
import org.springframework.integration.config.xml.SimpleHeaderEnricherParser;
|
||||
import org.springframework.integration.mail.MailHeaders;
|
||||
|
||||
/**
|
||||
* Namespace handler for the 'mail' namespace.
|
||||
@@ -31,7 +29,7 @@ public class MailNamespaceHandler extends AbstractIntegrationNamespaceHandler {
|
||||
this.registerBeanDefinitionParser("outbound-channel-adapter", new MailOutboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("inbound-channel-adapter", new MailInboundChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("imap-idle-channel-adapter", new ImapIdleChannelAdapterParser());
|
||||
this.registerBeanDefinitionParser("header-enricher", new SimpleHeaderEnricherParser(MailHeaders.PREFIX));
|
||||
this.registerBeanDefinitionParser("header-enricher", new MailHeaderEnricherParser());
|
||||
this.registerBeanDefinitionParser("mail-to-string-transformer", new MailToStringTransformerParser());
|
||||
}
|
||||
|
||||
|
||||
@@ -194,18 +194,26 @@
|
||||
</xsd:annotation>
|
||||
<xsd:complexContent>
|
||||
<xsd:extension base="transformerType">
|
||||
<xsd:attribute name="subject" type="xsd:string"/>
|
||||
<xsd:attribute name="to" type="xsd:string"/>
|
||||
<xsd:attribute name="cc" type="xsd:string"/>
|
||||
<xsd:attribute name="bcc" type="xsd:string"/>
|
||||
<xsd:attribute name="from" type="xsd:string"/>
|
||||
<xsd:attribute name="reply-to" type="xsd:string"/>
|
||||
<xsd:attribute name="overwrite" type="xsd:string"/>
|
||||
<xsd:choice minOccurs="1" maxOccurs="unbounded">
|
||||
<xsd:element name="subject" type="headerType"/>
|
||||
<xsd:element name="to" type="headerType"/>
|
||||
<xsd:element name="cc" type="headerType"/>
|
||||
<xsd:element name="bcc" type="headerType"/>
|
||||
<xsd:element name="from" type="headerType"/>
|
||||
<xsd:element name="reply-to" type="headerType"/>
|
||||
</xsd:choice>
|
||||
</xsd:extension>
|
||||
</xsd:complexContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
<xsd:complexType name="headerType">
|
||||
<xsd:attribute name="value" type="xsd:string" />
|
||||
<xsd:attribute name="ref" type="xsd:string" />
|
||||
<!-- TODO add 'overwrite' and the expression below -->
|
||||
<!-- xsd:attribute name="expression" type="xsd:string" / -->
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="transformerType">
|
||||
<xsd:attribute name="id" type="xsd:string"/>
|
||||
<xsd:attribute name="input-channel" type="xsd:string">
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
http://www.springframework.org/schema/integration/mail
|
||||
http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd">
|
||||
|
||||
<header-enricher input-channel="input"
|
||||
to="test.to"
|
||||
cc="test.cc"
|
||||
bcc="test.bcc"
|
||||
from="test.from"
|
||||
reply-to="test.reply-to"
|
||||
subject="test.subject"/>
|
||||
<header-enricher input-channel="input">
|
||||
<to value="test.to"/>
|
||||
<cc value="test.cc"/>
|
||||
<bcc value="test.bcc"/>
|
||||
<from value="test.from"/>
|
||||
<reply-to value="test.reply-to"/>
|
||||
<subject value="test.subject"/>
|
||||
</header-enricher>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
Reference in New Issue
Block a user