本文整理了Java中org.apache.tuscany.sca.invocation.Message.setBindingContext()
方法的一些代码示例,展示了Message.setBindingContext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setBindingContext()
方法的具体详情如下:
包路径:org.apache.tuscany.sca.invocation.Message
类名称:Message
方法名:setBindingContext
[英]Set the binding context that is in force for this message
[中]设置对此消息有效的绑定上下文
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-http-runtime
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HTTPContext bindingContext = new HTTPContext();
bindingContext.setHttpRequest(request);
bindingContext.setHttpResponse(response);
Message msg = messageFactory.createMessage();
msg.setBindingContext(bindingContext);
Message responseMessage = wire.invoke(msg);
// return response to client
if (responseMessage.isFault()) {
// Turn a fault into an exception
Throwable e = (Throwable)responseMessage.getBody();
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
}
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-rest-runtime
requestMessage.setBindingContext(bindingContext);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-rest-runtime
requestMessage.setBindingContext(bindingContext);
requestMessage.setBody(new Object[]{request, response});
Message responseMessage = serviceInvoker.invoke(requestMessage);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
protected void invokeReference(Message requestJMSMsg) throws JMSException, InvocationTargetException {
// create the Tuscany message
org.apache.tuscany.sca.invocation.Message tuscanyMsg = messageFactory.createMessage();
// populate the message context with JMS binding information
JMSBindingContext context = new JMSBindingContext();
tuscanyMsg.setBindingContext(context);
context.setJmsMsg(requestJMSMsg);
context.setJmsResourceFactory(jmsResourceFactory);
context.setReplyToDestination(requestJMSMsg.getJMSReplyTo());
// set the message body
tuscanyMsg.setBody(requestJMSMsg);
// call the runtime wire - the response is handled by the
// transport interceptor
endpointReference.invokeAsyncResponse(tuscanyMsg);
} // end method invokeReference
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
/**
* Process forward request message
* @param tuscanyMsg - the request message
* @return the processed version of the request message
*/
public Message processRequest(Message tuscanyMsg) {
try {
// populate the message context with JMS binding information
JMSBindingContext context = new JMSBindingContext();
context.setJmsResourceFactory(jmsResourceFactory);
tuscanyMsg.setBindingContext(context);
// get a JMS session to cover the creation and sending of the message
Session session = context.getJmsSession();
context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
context.setReplyToDestination(getReplyToDestination(session));
return tuscanyMsg;
} catch (Exception e) {
throw new JMSBindingException(e);
} // end try
} // end method processRequest
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
// The Binding Context may be null on an asynchronous response - in which case, create a new one
if(context == null) {
context = createBindingContext();
msg.setBindingContext(context);
}
Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {
responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
} else {
Object response = msg.getBody();
responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
}
msg.setBody(responseJMSMsg);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
// The Binding Context may be null on an asynchronous response - in which case, create a new one
if(context == null) {
context = createBindingContext();
msg.setBindingContext(context);
}
Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {
responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
} else {
responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
}
msg.setBody(responseJMSMsg);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
// The Binding Context may be null on an asynchronous response - in which case, create a new one
if(context == null) {
context = createBindingContext();
msg.setBindingContext(context);
}
Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {
responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
} else {
Object response = msg.getBody();
responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
}
msg.setBody(responseJMSMsg);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
// The Binding Context may be null on an asynchronous response - in which case, create a new one
if(context == null) {
context = createBindingContext();
msg.setBindingContext(context);
}
Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg = null;
if (msg.isFault()) {
responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
} else {
responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
}
msg.setBody(responseJMSMsg);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2
bindingContext.setAxisInMessageContext(inMC);
msg.setBindingContext(bindingContext);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeResponse(Message msg) {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
// The Binding Context may be null on an asynchronous response - in which case, create a new one
if(context == null) {
context = createBindingContext();
msg.setBindingContext(context);
}
Session session = context.getJmsResponseSession();
javax.jms.Message responseJMSMsg;
if (msg.isFault()) {
responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
} else {
Object response = msg.getBody();
responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
}
msg.setBody(responseJMSMsg);
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
protected void invokeService(Message requestJMSMsg) throws JMSException, InvocationTargetException {
// create the tuscany message
org.apache.tuscany.sca.invocation.Message tuscanyMsg = messageFactory.createMessage();
// populate the message context with JMS binding information
JMSBindingContext context = new JMSBindingContext();
tuscanyMsg.setBindingContext(context);
context.setJmsMsg(requestJMSMsg);
context.setJmsResourceFactory(jmsResourceFactory);
context.setReplyToDestination(requestJMSMsg.getJMSReplyTo());
// set the message body
tuscanyMsg.setBody(requestJMSMsg);
// call the runtime wire - the response is handled by the
// transport interceptor
//getEndpoint(targetBinding).invoke(tuscanyMsg);
RuntimeEndpoint endpoint = getEndpoint(targetBinding);
if( endpoint.isAsyncInvocation() ) {
endpoint.invokeAsync(tuscanyMsg);
} else {
endpoint.invoke(tuscanyMsg);
} // end if
} // end method invokeService
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
msg.setBindingContext(context);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2
msg.setBindingContext(bindingContext);
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
tuscanyMsg.setBindingContext(context);
内容来源于网络,如有侵权,请联系作者删除!