本文整理了Java中org.apache.camel.Message.removeHeaders()
方法的一些代码示例,展示了Message.removeHeaders()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.removeHeaders()
方法的具体详情如下:
包路径:org.apache.camel.Message
类名称:Message
方法名:removeHeaders
暂无
代码示例来源:origin: org.apache.camel/camel-micrometer
protected boolean clearMetricsHeaders(Message in) {
return in.removeHeaders(HEADER_PATTERN);
}
}
代码示例来源:origin: org.apache.camel/camel-metrics
protected boolean clearMetricsHeaders(Message in) {
return in.removeHeaders(HEADER_PATTERN);
}
}
代码示例来源:origin: io.syndesis/trade-insight-buy-connector
public TradeInsightBuyComponent(String componentSchema) {
super("trade-insight-buy", componentSchema, TradeInsightBuyComponent.class.getName());
// remove all the headers, as we should not propagate any of them
// and set the content type as json which is what this connector uses
setBeforeProducer(exchange -> {
exchange.getIn().removeHeaders("*");
exchange.getIn().setHeader(CONTENT_TYPE, "application/json");
});
}
代码示例来源:origin: io.syndesis/trade-insight-sell-connector
public TradeInsightSellComponent(String componentSchema) {
super("trade-insight-sell", componentSchema, TradeInsightSellComponent.class.getName());
// remove all the headers, as we should not propagate any of them
// and set the content type as json which is what this connector uses
setBeforeProducer(exchange -> {
exchange.getIn().removeHeaders("*");
exchange.getIn().setHeader(CONTENT_TYPE, "application/json");
});
}
代码示例来源:origin: io.syndesis/day-trade-place-connector
public DayTradePlaceComponent(String componentSchema) {
super("day-trade-place", componentSchema, DayTradePlaceComponent.class.getName());
// remove all the headers as we should not propagate any of them
// and set the content type as json which is what this connector uses
setBeforeProducer(exchange -> {
exchange.getIn().removeHeaders("*");
exchange.getIn().setHeader(CONTENT_TYPE, "application/json");
});
}
代码示例来源:origin: io.syndesis.connector/connector-webhook
private void removeOutput(final Exchange exchange) {
exchange.getOut().setBody("");
exchange.getOut().removeHeaders("*");
if (exchange.getException() == null) {
// In case of exception, we leave the error code as is
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 204);
exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_TEXT, "No Content");
}
}
代码示例来源:origin: io.syndesis/trade-insight-top-connector
public TradeInsightTopComponent(String componentSchema) {
super("trade-insight-top", componentSchema, TradeInsightTopComponent.class.getName());
// remove all the headers, as we should not propagate any of them
// and set the content type as json which is what this connector uses
setBeforeProducer(exchange -> {
exchange.getIn().removeHeaders("*");
exchange.getIn().setHeader(CONTENT_TYPE, "application/json");
});
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapSynchronousRfcDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_SYNCHRONOUS_RFC_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_RFC_NAME_MESSAGE_HEADER, endpoint.getRfcName());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapTransactionalRfcDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_TRANSACTIONAL_RFC_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_RFC_NAME_MESSAGE_HEADER, endpoint.getRfcName());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapSynchronousRfcServerEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_SYNCHRONOUS_RFC_SERVER);
message.setHeader(SapConstants.SAP_SERVER_NAME_MESSAGE_HEADER, endpoint.getServerName());
message.setHeader(SapConstants.SAP_RFC_NAME_MESSAGE_HEADER, endpoint.getRfcName());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapTransactionalRfcServerEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_TRANSACTIONAL_RFC_SERVER);
message.setHeader(SapConstants.SAP_SERVER_NAME_MESSAGE_HEADER, endpoint.getServerName());
message.setHeader(SapConstants.SAP_RFC_NAME_MESSAGE_HEADER, endpoint.getRfcName());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapQueuedRfcDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_QUEUED_RFC_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_QUEUE_NAME_MESSAGE_HEADER, endpoint.getQueueName());
message.setHeader(SapConstants.SAP_RFC_NAME_MESSAGE_HEADER, endpoint.getRfcName());
}
代码示例来源:origin: org.ojbc.bundles.shared/ojb-fedquery-common
exchange.getIn().removeHeaders("*", "federatedQueryRequestGUID", "operationName", "operationNamespace", "tokenID", "webServiceEndpointToCall", Client.REQUEST_CONTEXT, Exchange.DESTINATION_OVERRIDE_URL);
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapTransactionalIDocListDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_IDOC_LIST_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_IDOC_TYPE_NAME_MESSAGE_HEADER, endpoint.getIdocType());
message.setHeader(SapConstants.SAP_IDOC_TYPE_EXTENSION_NAME_MESSAGE_HEADER, endpoint.getIdocTypeExtension());
message.setHeader(SapConstants.SAP_SYSTEM_RELEASE_NAME_MESSAGE_HEADER, endpoint.getSystemRelease());
message.setHeader(SapConstants.SAP_APPLICATION_RELEASE_NAME_MESSAGE_HEADER, endpoint.getApplicationRelease());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapQueuedIDocListDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_QUEUED_IDOC_LIST_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_IDOC_TYPE_NAME_MESSAGE_HEADER, endpoint.getIdocType());
message.setHeader(SapConstants.SAP_IDOC_TYPE_EXTENSION_NAME_MESSAGE_HEADER, endpoint.getIdocTypeExtension());
message.setHeader(SapConstants.SAP_SYSTEM_RELEASE_NAME_MESSAGE_HEADER, endpoint.getSystemRelease());
message.setHeader(SapConstants.SAP_APPLICATION_RELEASE_NAME_MESSAGE_HEADER, endpoint.getApplicationRelease());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapTransactionalIDocDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_IDOC_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_IDOC_TYPE_NAME_MESSAGE_HEADER, endpoint.getIdocType());
message.setHeader(SapConstants.SAP_IDOC_TYPE_EXTENSION_NAME_MESSAGE_HEADER, endpoint.getIdocTypeExtension());
message.setHeader(SapConstants.SAP_SYSTEM_RELEASE_NAME_MESSAGE_HEADER, endpoint.getSystemRelease());
message.setHeader(SapConstants.SAP_APPLICATION_RELEASE_NAME_MESSAGE_HEADER, endpoint.getApplicationRelease());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapQueuedIDocDestinationEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_QUEUED_IDOC_DESTINATION);
message.setHeader(SapConstants.SAP_DESTINATION_NAME_MESSAGE_HEADER, endpoint.getDestinationName());
message.setHeader(SapConstants.SAP_IDOC_TYPE_NAME_MESSAGE_HEADER, endpoint.getIdocType());
message.setHeader(SapConstants.SAP_IDOC_TYPE_EXTENSION_NAME_MESSAGE_HEADER, endpoint.getIdocTypeExtension());
message.setHeader(SapConstants.SAP_SYSTEM_RELEASE_NAME_MESSAGE_HEADER, endpoint.getSystemRelease());
message.setHeader(SapConstants.SAP_APPLICATION_RELEASE_NAME_MESSAGE_HEADER, endpoint.getApplicationRelease());
}
代码示例来源:origin: org.fusesource/camel-sap
/**
* Add endpoint parameters to SAP Camel component message headers.
*
* @param endpoint
* - the endpoint whose parameters are added.
* @param message
* - the message added to.
*/
public static void addSapHeadersToMessage(SapTransactionalIDocListServerEndpoint endpoint, Message message) {
message.removeHeaders(SapConstants.PROPERTY_PREFIX
+ "*"); /* Remove any previous SAP headers */
message.setHeader(SapConstants.SAP_SCHEME_NAME_MESSAGE_HEADER, SapConstants.SAP_IDOC_LIST_SERVER);
message.setHeader(SapConstants.SAP_SERVER_NAME_MESSAGE_HEADER, endpoint.getServerName());
message.setHeader(SapConstants.SAP_IDOC_TYPE_NAME_MESSAGE_HEADER, endpoint.getIdocType());
message.setHeader(SapConstants.SAP_IDOC_TYPE_EXTENSION_NAME_MESSAGE_HEADER, endpoint.getIdocTypeExtension());
message.setHeader(SapConstants.SAP_SYSTEM_RELEASE_NAME_MESSAGE_HEADER, endpoint.getSystemRelease());
message.setHeader(SapConstants.SAP_APPLICATION_RELEASE_NAME_MESSAGE_HEADER, endpoint.getApplicationRelease());
}
}
代码示例来源:origin: io.syndesis.connector/connector-api-provider
@Override
public void customize(ComponentProxyComponent component, Map<String, Object> options) {
final List<Processor> beforeConsumers = new ArrayList<>(2);
if (outputDataShape != null && outputDataShape.getKind() == DataShapeKinds.JSON_SCHEMA && outputDataShape.getSpecification() != null) {
try {
final JsonNode schema = READER.readTree(outputDataShape.getSpecification());
Set<String> properties = SimpleJsonSchemaInspector.getProperties(schema);
Set<String> extraneousProperties = new HashSet<>(properties);
extraneousProperties.removeAll(Arrays.asList("parameters", "body"));
if (!properties.isEmpty() && extraneousProperties.isEmpty()) {
beforeConsumers.add(new HttpRequestWrapperProcessor(schema));
}
} catch (IOException e) {
throw new RuntimeCamelException(e);
}
}
// removes all non Syndesis.* headers, this is so the headers that might
// influence HTTP components in the flow after this connector don't
// interpret them, for instance the `Host` header is particularly
// troublesome
beforeConsumers.add((e) -> e.getIn().removeHeaders("*", "Syndesis.*"));
component.setBeforeConsumer(Pipeline.newInstance(context, beforeConsumers));
}
代码示例来源:origin: io.syndesis.connector/connector-webhook
@Test
public void shouldDestroyAllOutput() throws Exception {
final WebhookConnectorCustomizer customizer = new WebhookConnectorCustomizer();
customizer.customize(component, Collections.emptyMap());
final Processor afterConsumer = component.getAfterConsumer();
assertThat(afterConsumer).isNotNull();
final Exchange exchange = mock(Exchange.class);
final Message message = mock(Message.class);
when(exchange.getOut()).thenReturn(message);
afterConsumer.process(exchange);
verify(message).setBody("");
verify(message).removeHeaders("*");
verify(message).setHeader(Exchange.HTTP_RESPONSE_CODE, 204);
verify(message).setHeader(Exchange.HTTP_RESPONSE_TEXT, "No Content");
}
内容来源于网络,如有侵权,请联系作者删除!