本文整理了Java中org.apache.tuscany.sca.invocation.Message.setBody()
方法的一些代码示例,展示了Message.setBody()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setBody()
方法的具体详情如下:
包路径:org.apache.tuscany.sca.invocation.Message
类名称:Message
方法名:setBody
[英]Sets the body of the message.
[中]设置消息的正文。
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public Message processRequest(Message msg) {
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(Invocable.class.getName(), invocable);
Object input = mediator.mediateInput(msg.getBody(), sourceOperation, targetOperation, metadata);
msg.setBody(input);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-core-databinding
public Message processRequest(Message msg) {
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put(Invocable.class.getName(), invocable);
Object input = mediator.mediateInput(msg.getBody(), sourceOperation, targetOperation, metadata);
msg.setBody(input);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-osgi-runtime
public Message invoke(Message msg) {
try {
Object resp = invokeTarget(msg);
msg.setBody(resp);
} catch (InvocationTargetException e) {
msg.setFaultBody(e.getCause());
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-http-runtime
private Message invokeRequest(Message msg) throws IOException, SAXException {
HTTPContext context = msg.getBindingContext();
HttpServletRequest servletRequest = context.getHttpRequest();
if ("GET".equals(servletRequest.getMethod())) {
msg.setBody(getRequestFromQueryString(msg.getOperation(), servletRequest));
} else {
msg.setBody(new Object[]{domHelper.load(read(servletRequest))});
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-http-runtime
private Message invokeRequest(Message msg) throws IOException {
HTTPContext context = msg.getBindingContext();
HttpServletRequest servletRequest = context.getHttpRequest();
if ("GET".equals(servletRequest.getMethod())) {
msg.setBody(getRequestFromQueryString(msg.getOperation(), servletRequest));
} else {
msg.setBody(getRequestFromPost(msg.getOperation(), servletRequest));
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
msg.setBody(new Object[]{requestPayload});
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
msg.setBody(new Object[] { requestPayload });
return msg;
}
代码示例来源:origin: com.jns.apps/scallop-binding-rmi-runtime
public Message invoke(Message msg) {
try {
Object[] args = msg.getBody();
Object resp = invokeTarget(args);
msg.setBody(resp);
} catch (InvocationTargetException e) {
msg.setFaultBody(e.getCause());
} catch (Exception e) {
msg.setFaultBody(e);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
msg.setBody(new Object[]{requestPayload});
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
javax.jms.Message jmsMsg = context.getJmsMsg();
Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
msg.setBody(new Object[]{requestPayload});
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
Message msg = messageFactory.createMessage();
msg.setBody(args);
Message resp = invoke(operation, msg);
Object body = resp.getBody();
if (resp.isFault()) {
throw new InvocationTargetException((Throwable)body);
}
return body;
}
代码示例来源:origin: org.apache.tuscany.sca.aggregation/tuscany-binding-rmi-runtime-aggregation
public Message invoke(Message msg) {
try {
Object[] args = msg.getBody();
Object resp = invokeTarget(args);
msg.setBody(resp);
} catch (InvocationTargetException e) {
msg.setFaultBody(e.getCause());
} catch (Throwable e) {
msg.setFaultBody(e);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-rmi-runtime
public Message invoke(Message msg) {
try {
Object[] args = msg.getBody();
Object resp = invokeTarget(args);
msg.setBody(resp);
} catch (InvocationTargetException e) {
msg.setFaultBody(e.getCause());
} catch (Throwable e) {
msg.setFaultBody(e);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jsonp-runtime
public Message doInvoke(Message msg) throws JsonGenerationException, JsonMappingException, IOException, EncoderException {
String uri = endpoint.getDeployedURI() + "/" + operation.getName();
//String[] jsonArgs = objectsToJSON((Object[])msg.getBody());
String[] jsonArgs = objectsToJSONStrings((Object[])msg.getBody());
String responseJSON = invokeHTTPRequest(uri, jsonArgs);
//Object response = jsonToObjects(responseJSON)[0];
msg.setBody(responseJSON);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-http-runtime
@Override
public Message invoke(Message msg) {
HTTPContext context = msg.getBindingContext();
msg.setBody(new Object[] {context.getHttpRequest(), context.getHttpResponse()});
return getNext().invoke(msg);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-script-runtime
public Message invoke(Message msg) {
try {
Object resp = doInvoke((Object[])msg.getBody(), msg.getOperation());
msg.setBody(resp);
} catch (ScriptException e) {
msg.setFaultBody(e.getCause());
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
Message responseMsg = invokeRequest(msg);
// get the jms context
JMSBindingContext context = msg.getBindingContext();
// [rfeng] For oneway operation as part of the bi-directional interface, the JMSReplyTo is present
if (context.getReplyToDestination() == null || msg.getOperation().isNonBlocking()) {
responseMsg.setBody(null);
} else {
responseMsg = invokeResponse(msg);
}
return responseMsg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
try {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
msg.setBody(requestMsg);
requestMsg.setJMSReplyTo(context.getReplyToDestination());
return msg;
} catch (JMSException e) {
throw new JMSBindingException(e);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-core-databinding
public Message invoke(Message msg) {
if (chain.allowsPassByReference()) {
return nextInvoker.invoke(msg);
}
msg.setBody(mediator.copyInput(msg.getBody(), operation));
Message resultMsg = nextInvoker.invoke(msg);
if (!resultMsg.isFault() && operation.getOutputType() != null) {
resultMsg.setBody(mediator.copyOutput(resultMsg.getBody(), operation));
}
if (resultMsg.isFault()) {
resultMsg.setFaultBody(mediator.copyFault(resultMsg.getBody(), operation));
}
return resultMsg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
try {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
msg.setBody(requestMsg);
requestMsg.setJMSReplyTo(context.getReplyToDestination());
return msg;
} catch (JMSException e) {
throw new JMSBindingException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!