org.switchyard.Message.getContent()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(204)

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

Message.getContent介绍

[英]Returns the content from the body of the message.
[中]返回消息正文中的内容。

代码示例

代码示例来源:origin: org.switchyard/switchyard-test

@Override
  public Throwable getCause() {
    if (Throwable.class.isAssignableFrom(_faultMessage.getContent().getClass())) {
      return _faultMessage.getContent(Throwable.class);
    } else {
      return super.getCause();
    }
  }
}

代码示例来源:origin: jboss-switchyard/core

@Override
  public Throwable getCause() {
    if (Throwable.class.isAssignableFrom(_faultMessage.getContent().getClass())) {
      return _faultMessage.getContent(Throwable.class);
    } else {
      return super.getCause();
    }
  }
}

代码示例来源:origin: org.switchyard.components/switchyard-component-bean

private static Object[] castArg(Method method, Message message) {
  if (method.getParameterTypes().length == 1 && message != null) {
    return new Object[]{message.getContent(method.getParameterTypes()[0])};
  }
  return null;
}

代码示例来源:origin: jboss-switchyard/components

private static Object[] castArg(Method method, Message message) {
  if (method.getParameterTypes().length == 1 && message != null) {
    return new Object[]{message.getContent(method.getParameterTypes()[0])};
  }
  return null;
}

代码示例来源:origin: org.switchyard.components/switchyard-component-bean

/**
 * {@inheritDoc}
 */
@Override
public Object getContent() {
  return getMessage().getContent();
}

代码示例来源:origin: org.switchyard.components/switchyard-component-bean

/**
 * {@inheritDoc}
 */
@Override
public <T> T getContent(Class<T> type) {
  return getMessage().getContent(type);
}

代码示例来源:origin: jboss-switchyard/components

/**
 * {@inheritDoc}
 */
@Override
public <T> T getContent(Class<T> type) {
  return getMessage().getContent(type);
}

代码示例来源:origin: org.switchyard.components/switchyard-component-common-knowledge

private static List<Object> getInputList(Message message, List<ExpressionMapping> inputs, KnowledgeRuntimeEngine runtime) {
  List<Object> list = new ArrayList<Object>();
  if (inputs.size() > 0) {
    list.addAll(getList(message, inputs));
  } else {
    expand(filterRemoteDefaultInputContent(message.getContent(), runtime), list);
  }
  return list;
}

代码示例来源:origin: jboss-switchyard/components

private static List<Object> getInputList(Message message, List<ExpressionMapping> inputs, KnowledgeRuntimeEngine runtime) {
  List<Object> list = new ArrayList<Object>();
  if (inputs.size() > 0) {
    list.addAll(getList(message, inputs));
  } else {
    expand(filterRemoteDefaultInputContent(message.getContent(), runtime), list);
  }
  return list;
}

代码示例来源:origin: org.switchyard.components/switchyard-component-common-knowledge

@Override
  public void handleFault(Exchange exchange) {
    _fault = exchange.getMessage().getContent();
    super.handleFault(exchange);
  }
}

代码示例来源:origin: jboss-switchyard/components

@Override
  public void handleFault(Exchange exchange) {
    _fault = exchange.getMessage().getContent();
    super.handleFault(exchange);
  }
}

代码示例来源:origin: jboss-switchyard/components

private static List<Object> getList(Message message, List<ExpressionMapping> expressionMappings) {
  List<Object> list = new ArrayList<Object>();
  if (expressionMappings == null || expressionMappings.size() == 0) {
    expand(message.getContent(), list);
  } else {
    Map<String, List<Object>> listMap = getListMap(message, expressionMappings, true, toVariable(message));
    for (List<Object> value : listMap.values()) {
      expand(value, list);
    }
  }
  return list;
}

代码示例来源:origin: org.switchyard.components/switchyard-component-common-knowledge

private static List<Object> getList(Message message, List<ExpressionMapping> expressionMappings) {
  List<Object> list = new ArrayList<Object>();
  if (expressionMappings == null || expressionMappings.size() == 0) {
    expand(message.getContent(), list);
  } else {
    Map<String, List<Object>> listMap = getListMap(message, expressionMappings, true, toVariable(message));
    for (List<Object> value : listMap.values()) {
      expand(value, list);
    }
  }
  return list;
}

代码示例来源:origin: jboss-switchyard/core

@Test
public void testContent() throws Exception {
  final String message = "Hello There!";
  _message.setContent(message);
  Assert.assertEquals(message, _message.getContent());
  // the following tests to make sure casting to same type works
  String content = _message.getContent(String.class);
  Assert.assertEquals(message, content);
}

代码示例来源:origin: jboss-switchyard/core

@Override
  public void handleMessage(Exchange exchange) throws HandlerException {
    String content = (String) exchange.getMessage().getContent();
    if (content.equals("Hello there, SwitchYard")) {
      success=true;
    }
  }
}

代码示例来源:origin: org.switchyard.quickstarts/switchyard-bean-service

@Override
public void after(String target, Exchange exchange) throws HandlerException {
  // We only want to intercept successful replies from OrderService
  if (exchange.getProvider().getName().getLocalPart().equals("OrderService")
    && ExchangeState.OK.equals(exchange.getState())) {
    OrderAck orderAck = exchange.getMessage().getContent(OrderAck.class);
    orderAck.setStatus(orderAck.getStatus() + " [intercepted]");
  }
}

代码示例来源:origin: org.switchyard.quickstarts/switchyard-quickstart-http-binding

/**
 * {@inheritDoc}
 */
@Override
public HttpBindingData decompose(Exchange exchange, HttpBindingData target) throws Exception {
  Object content = exchange.getMessage().getContent();
  if ((content instanceof String) && (content.equals(""))) {
    exchange.getContext().setProperty(HttpContextMapper.HTTP_RESPONSE_STATUS, 404).addLabels(new String[]{EndpointLabel.HTTP.label()});
  }
  target = super.decompose(exchange, target);
  return target;
}

代码示例来源:origin: jboss-switchyard/release

@Override
public org.switchyard.Message compose(JMSBindingData source, Exchange exchange) throws Exception {
  org.switchyard.Message msg = super.compose(source, exchange);
  msg.setContent(msg.getContent(String.class) + "test");
  return msg;
}

代码示例来源:origin: jboss-switchyard/components

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public IndexedRecordBindingData decompose(Exchange exchange, IndexedRecordBindingData target) throws Exception {
  Message sourceMessage = exchange.getMessage();
  getContextMapper().mapTo(exchange.getContext(), target);
  final List<?> content = sourceMessage.getContent(List.class);
  target.getRecord().addAll(content);
  return target;
}

代码示例来源:origin: jboss-switchyard/release

@Override
public JMSBindingData decompose(Exchange exchange, JMSBindingData target) throws Exception {
  exchange.getMessage().setContent(exchange.getMessage().getContent(String.class)+"test");
  return super.decompose(exchange, target);
}

相关文章