INT-3811: Support Negative Matches on Header Map
JIRA: https://jira.spring.io/browse/INT-3811 Polishing - PR Comments
This commit is contained in:
committed by
Artem Bilan
parent
583371007a
commit
edb30efcd5
@@ -1059,11 +1059,14 @@ public IntegrationFlow pubSubInFlow(ConnectionFactory connectionFactory) {
|
||||
=== AMQP Message Headers
|
||||
|
||||
The Spring Integration AMQP Adapters will map standard AMQP properties automatically.
|
||||
These properties will be copied by default to and from Spring Integration `MessageHeaders` using the http://static.springsource.org/spring-integration/api/org/springframework/integration/amqp/support/DefaultAmqpHeaderMapper.html[DefaultAmqpHeaderMapper].
|
||||
These properties will be copied by default to and from Spring Integration `MessageHeaders` using the
|
||||
http://docs.spring.io/spring-integration/api/org/springframework/integration/amqp/support/DefaultAmqpHeaderMapper.html[DefaultAmqpHeaderMapper].
|
||||
|
||||
Of course, you can pass in your own implementation of AMQP specific header mappers, as the adapters have respective properties to support that.
|
||||
|
||||
Any user-defined headers within the AMQP http://static.springsource.org/spring-amqp/api/org/springframework/amqp/core/MessageProperties.html[MessageProperties] will NOT be copied to or from an AMQP Message, unless explicitly specified by the _requestHeaderNames_ and/or _replyHeaderNames_ properties of the `DefaultAmqpHeaderMapper`.
|
||||
Any user-defined headers within the AMQP http://docs.spring.io/spring-amqp/api/org/springframework/amqp/core/MessageProperties.html[MessageProperties] will NOT
|
||||
be copied to or from an AMQP Message, unless explicitly specified by the _requestHeaderNames_ and/or
|
||||
_replyHeaderNames_ properties of the `DefaultAmqpHeaderMapper`.
|
||||
|
||||
TIP: When mapping user-defined headers, the values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched.
|
||||
For example, if you need to copy all user-defined headers simply use the wildcard character `*`, but see the CAUTION below.
|
||||
@@ -1142,6 +1145,14 @@ before sending the reply to the AMQP Inbound Gateway.
|
||||
Alternatively, you could explicitly list those properties that you actually want mapped instead of using
|
||||
wildcards.
|
||||
|
||||
Starting with _version 4.3_, patterns in the header mappings can be negated by preceding the pattern with `!`.
|
||||
Negated patterns get priority, so a list such as
|
||||
`STANDARD_REQUEST_HEADERS,foo,ba*,!bar,!baz,qux,!foo` will *NOT* map `foo`
|
||||
(nor `bar` nor `baz`); the standard headers plus `bad`, `qux` will be mapped.
|
||||
|
||||
IMPORTANT: If you have a user defined header that begins with `!` that you *do* wish to map, you need to escape it with
|
||||
`\` thus: `STANDARD_REQUEST_HEADERS,\!myBangHeader` and it *WILL* be mapped.
|
||||
|
||||
=== AMQP Samples
|
||||
|
||||
To experiment with the AMQP adapters, check out the samples available in the Spring Integration Samples Git repository at:
|
||||
|
||||
@@ -114,7 +114,7 @@ See <<http-inbound>> for more information.
|
||||
A new factory bean is provided to simplify the configuration of Jsch proxies for SFTP.
|
||||
See <<sftp-proxy-factory-bean>> for more information.
|
||||
|
||||
==== Routers Changes
|
||||
==== Router Changes
|
||||
|
||||
The `ErrorMessageExceptionTypeRouter` supports now the `Exception` superclass mappings to avoid duplication
|
||||
for the same channel in case of several inheritors.
|
||||
@@ -122,3 +122,9 @@ For this purpose the `ErrorMessageExceptionTypeRouter` loads mapping classes dur
|
||||
for a `ClassNotFoundException`.
|
||||
|
||||
See <<router>> for more information.
|
||||
|
||||
==== Header Mapping
|
||||
|
||||
AMQP, WS and XMPP header mappings (e.g. `request-header-mapping`, `reply-header-mapping`) now support negated
|
||||
patterns.
|
||||
See <<amqp-message-headers>>, <<ws-message-headers>>, and <<xmpp-message-headers>> for more information.
|
||||
|
||||
@@ -165,3 +165,34 @@ If you wish to partially encode some of the URL, this can be achieved using an `
|
||||
----
|
||||
|
||||
Note, `encode-uri` is ignored, if `DestinationProvider` is supplied.
|
||||
|
||||
[[ws-message-headers]]
|
||||
=== WS Message Headers
|
||||
|
||||
The Spring Integration WebService Gateways will map the SOAP Action header automatically.
|
||||
It will be copied by default to and from Spring Integration `MessageHeaders` using the
|
||||
http://docs.spring.io/spring-integration/api/org/springframework/integration/ws/DefaultSoapHeaderMapper.html[DefaultSoapHeaderMapper].
|
||||
|
||||
Of course, you can pass in your own implementation of SOAP specific header mappers, as the gateways have respective properties to support that.
|
||||
|
||||
Any user-defined headers will NOT
|
||||
be copied to or from an SOAP Message, unless explicitly specified by the _requestHeaderNames_ and/or
|
||||
_replyHeaderNames_ properties of the `DefaultSoapHeaderMapper`.
|
||||
|
||||
TIP: When mapping user-defined headers, the values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to be matched.
|
||||
For example, if you need to copy all user-defined headers simply use the wildcard character `*`.
|
||||
|
||||
Starting with _version 4.1_, the `AbstractHeaderMapper` (a `DefaultSoapHeaderMapper` superclass) allows the
|
||||
`NON_STANDARD_HEADERS` token to be configured for the _requestHeaderNames_ and/or _replyHeaderNames_
|
||||
properties (in addition to existing `STANDARD_REQUEST_HEADERS` and `STANDARD_REPLY_HEADERS`) to map all
|
||||
user-defined headers.
|
||||
Note, it is recommended to use the combination like this `STANDARD_REPLY_HEADERS, NON_STANDARD_HEADERS` instead of a
|
||||
`*`, to avoid mapping of _request_ headers to the reply.
|
||||
|
||||
Starting with _version 4.3_, patterns in the header mappings can be negated by preceding the pattern with `!`.
|
||||
Negated patterns get priority, so a list such as
|
||||
`STANDARD_REQUEST_HEADERS,foo,ba*,!bar,!baz,qux,!foo` will *NOT* map `foo`
|
||||
(nor `bar` nor `baz`); the standard headers plus `bad`, `qux` will be mapped.
|
||||
|
||||
IMPORTANT: If you have a user defined header that begins with `!` that you *do* wish to map, you need to escape it with
|
||||
`\` thus: `STANDARD_REQUEST_HEADERS,\!myBangHeader` and it *WILL* be mapped.
|
||||
|
||||
@@ -219,3 +219,40 @@ public class CustomConnectionConfiguration {
|
||||
----
|
||||
|
||||
For more information on the JavaConfig style of Application Context configuration, refer to the following section in the Spring Reference Manual: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-java
|
||||
|
||||
[[xmpp-message-headers]]
|
||||
=== XMPP Message Headers
|
||||
|
||||
The Spring Integration XMPP Adapters will map standard XMPP properties automatically.
|
||||
These properties will be copied by default to and from Spring Integration `MessageHeaders` using the
|
||||
http://docs.spring.io/spring-integration/api/org/springframework/integration/xmpp/support/DefaultXmppHeaderMapper.html[DefaultXmppHeaderMapper].
|
||||
|
||||
Any user-defined headers will NOT be copied to or from an XMPP Message, unless explicitly specified by the
|
||||
_requestHeaderNames_ and/or _replyHeaderNames_ properties of the `DefaultXmppHeaderMapper`.
|
||||
|
||||
TIP: When mapping user-defined headers, the values can also contain simple wildcard patterns (e.g. "foo*" or "*foo") to
|
||||
be matched.
|
||||
|
||||
Starting with _version 4.1_, the `AbstractHeaderMapper` (a `DefaultXmppHeaderMapper` superclass) allows the
|
||||
`NON_STANDARD_HEADERS` token to be configured for the _requestHeaderNames_ property (in addition to existing
|
||||
`STANDARD_REQUEST_HEADERS`) to map all user-defined headers.
|
||||
|
||||
Class `org.springframework.xmpp.XmppHeaders` identifies the default headers that will be used by the `DefaultXmppHeaderMapper`:
|
||||
|
||||
* xmpp_from
|
||||
|
||||
* xmpp_subject
|
||||
|
||||
* xmpp_thread
|
||||
|
||||
* xmpp_to
|
||||
|
||||
* xmpp_type
|
||||
|
||||
Starting with _version 4.3_, patterns in the header mappings can be negated by preceding the pattern with `!`.
|
||||
Negated patterns get priority, so a list such as
|
||||
`STANDARD_REQUEST_HEADERS,foo,ba*,!bar,!baz,qux,!foo` will *NOT* map `foo`
|
||||
(nor `bar` nor `baz`); the standard headers plus `bad`, `qux` will be mapped.
|
||||
|
||||
IMPORTANT: If you have a user defined header that begins with `!` that you *do* wish to map, you need to escape it with
|
||||
`\` thus: `STANDARD_REQUEST_HEADERS,\!myBangHeader` and it *WILL* be mapped.
|
||||
|
||||
Reference in New Issue
Block a user