org.springframework.integration.support.AbstractIntegrationMessageBuilder.filterAndCopyHeadersIfAbsent()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.springframework.integration.support.AbstractIntegrationMessageBuilder.filterAndCopyHeadersIfAbsent()方法的一些代码示例,展示了AbstractIntegrationMessageBuilder.filterAndCopyHeadersIfAbsent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractIntegrationMessageBuilder.filterAndCopyHeadersIfAbsent()方法的具体详情如下:
包路径:org.springframework.integration.support.AbstractIntegrationMessageBuilder
类名称:AbstractIntegrationMessageBuilder
方法名:filterAndCopyHeadersIfAbsent

AbstractIntegrationMessageBuilder.filterAndCopyHeadersIfAbsent介绍

[英]Remove headers from the provided map matching to the provided pattens and only after that copy the result into the target message headers.
[中]从提供的映射中删除与提供的模式匹配的标题,然后将结果复制到目标消息标题中。

代码示例

代码示例来源:origin: spring-projects/spring-integration

@Override
public final Message<?> transform(Message<?> message) {
  Object result = this.messageProcessor.processMessage(message);
  if (result == null) {
    return null;
  }
  if (result instanceof Message<?>) {
    return (Message<?>) result;
  }
  MessageHeaders requestHeaders = message.getHeaders();
  return getMessageBuilderFactory()
      .withPayload(result)
      .filterAndCopyHeadersIfAbsent(requestHeaders,
          this.selectiveHeaderPropagation ? this.notPropagatedHeaders : null)
      .build();
}

代码示例来源:origin: spring-projects/spring-integration

protected Message<?> createOutputMessage(Object output, MessageHeaders requestHeaders) {
  AbstractIntegrationMessageBuilder<?> builder = null;
  if (output instanceof Message<?>) {
    if (this.noHeadersPropagation || !shouldCopyRequestHeaders()) {
      return (Message<?>) output;
    }
    builder = this.getMessageBuilderFactory().fromMessage((Message<?>) output);
  }
  else if (output instanceof AbstractIntegrationMessageBuilder) {
    builder = (AbstractIntegrationMessageBuilder<?>) output;
  }
  else {
    builder = this.getMessageBuilderFactory().withPayload(output);
  }
  if (!this.noHeadersPropagation && shouldCopyRequestHeaders()) {
    builder.filterAndCopyHeadersIfAbsent(requestHeaders,
        this.selectiveHeaderPropagation ? this.notPropagatedHeaders : null);
  }
  return builder.build();
}

代码示例来源:origin: org.springframework.integration/spring-integration-core

@Override
public final Message<?> transform(Message<?> message) {
  Object result = this.messageProcessor.processMessage(message);
  if (result == null) {
    return null;
  }
  if (result instanceof Message<?>) {
    return (Message<?>) result;
  }
  MessageHeaders requestHeaders = message.getHeaders();
  return getMessageBuilderFactory()
      .withPayload(result)
      .filterAndCopyHeadersIfAbsent(requestHeaders,
          this.selectiveHeaderPropagation ? this.notPropagatedHeaders : null)
      .build();
}

代码示例来源:origin: org.springframework.integration/spring-integration-core

protected Message<?> createOutputMessage(Object output, MessageHeaders requestHeaders) {
  AbstractIntegrationMessageBuilder<?> builder = null;
  if (output instanceof Message<?>) {
    if (this.noHeadersPropagation || !shouldCopyRequestHeaders()) {
      return (Message<?>) output;
    }
    builder = this.getMessageBuilderFactory().fromMessage((Message<?>) output);
  }
  else if (output instanceof AbstractIntegrationMessageBuilder) {
    builder = (AbstractIntegrationMessageBuilder<?>) output;
  }
  else {
    builder = this.getMessageBuilderFactory().withPayload(output);
  }
  if (!this.noHeadersPropagation && shouldCopyRequestHeaders()) {
    builder.filterAndCopyHeadersIfAbsent(requestHeaders,
        this.selectiveHeaderPropagation ? this.notPropagatedHeaders : null);
  }
  return builder.build();
}

相关文章