本文整理了Java中org.apache.tuscany.sca.invocation.Message.getOperation()
方法的一些代码示例,展示了Message.getOperation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getOperation()
方法的具体详情如下:
包路径:org.apache.tuscany.sca.invocation.Message
类名称:Message
方法名:getOperation
[英]Returns the operation that created the message.
[中]返回创建消息的操作。
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
public Message invoke(Message msg) {
return invoke(msg.getOperation(), 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-implementation-osgi-runtime
private Object invokeTarget(Message msg) throws InvocationTargetException {
Operation op = msg.getOperation();
if (op == null) {
op = this.operation;
}
try {
Object instance = provider.getOSGiService(service);
Method m = findMethod(instance.getClass(), operation);
Object ret = invokeMethod(instance, m, msg);
return ret;
} catch (InvocationTargetException e) {
throw e;
} catch (Exception e) {
throw new InvocationTargetException(e);
}
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
/**
* Initiate the sending of the response part of an asynchronous
* exchange along the response part of the wire.
*
* @param msg the response message
*/
public void invokeAsyncResponse(Message msg) {
InvocationChain chain = invocable.getInvocationChain(msg.getOperation());
Invoker tailInvoker = chain.getTailInvoker();
((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg);
} // end method invokeAsyncResponse
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invokeRequest(Message msg) {
// TODO - could probably optimize this better
String operationName = msg.getOperation().getName();
String operationNameOverride = jmsBinding.getOpNameFromNativeOperationName(operationName);
if (operationNameOverride != null) {
for (Operation op : serviceOperations) {
if (op.getName().equals(operationNameOverride)) {
msg.setOperation(op);
break;
}
}
}
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-ws-runtime-axis2
/**
* Setup the necessary infrastructure for the Async response handling
* @param msg
* @param callbackAddress
*/
private void setupAsyncResponse(Message msg, String callbackAddress) {
if( !endpoint.isAsyncInvocation() ) return;
endpoint.createAsyncServerCallback();
RuntimeEndpointReference asyncCallback = endpoint.getAsyncServerCallback();
// Create a response invoker, containing the callback address and add it to the message headers
AsyncResponseInvoker<String> respInvoker =
new AsyncResponseInvoker<String>(endpoint, asyncCallback,
callbackAddress,
(String)msg.getHeaders().get(Constants.MESSAGE_ID),
msg.getOperation().getName(), messageFactory);
msg.getHeaders().put(Constants.ASYNC_RESPONSE_INVOKER, respInvoker);
} // end method setupAsyncResponse
代码示例来源: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 invokeRequest(Message msg) {
try {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
Session session = context.getJmsSession();
javax.jms.Message requestMsg;
if (((WireFormatJMSDefault) jmsBinding.getRequestWireFormat()).isUseBytesMessage()) {
requestMsg = requestMessageProcessor.insertPayloadIntoJMSBytesMessage(session, msg.getBody(), this.inputWrapperMap.get(msg.getOperation().getName()));
} else {
requestMsg = requestMessageProcessor.insertPayloadIntoJMSTextMessage(session, msg.getBody(), this.inputWrapperMap.get(msg.getOperation().getName()));
}
msg.setBody(requestMsg);
requestMsg.setJMSReplyTo(context.getReplyToDestination());
return msg;
} catch (JMSException e) {
throw new JMSBindingException(e);
}
}
代码示例来源: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-base-runtime
public void invokeAsyncResponse(Message msg){
// If there is a Binding Chain, invoke it first...
InvocationChain chain = this.getBindingInvocationChain();
if( chain != null ) {
Invoker tailInvoker = chain.getTailInvoker();
if (tailInvoker != null) {
((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg);
} // end if
} // end if
chain = this.getInvocationChain(msg.getOperation());
Invoker tailInvoker = chain.getTailInvoker();
((InvokerAsyncResponse)tailInvoker).invokeAsyncResponse(msg);
} // end method invokeAsyncResponse
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault) {
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
// if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault) {
msg = invokeResponse(msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
msg = invokeResponse(msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
msg = invokeResponse(msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytes){
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytes){
msg = invokeResponse(msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSText){
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSText){
msg = invokeResponse(msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime
public Message invoke(Message msg) {
if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSObject){
msg = invokeRequest(msg);
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSObject){
msg = invokeResponse(msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-rest-runtime
public Message invoke(Message msg) {
HTTPContext bindingContext = (HTTPContext) msg.getBindingContext();
if (bindingContext == null) {
return getNext().invoke(msg);
}
if (binding.getRequestWireFormat() instanceof XMLWireFormat) {
if( isPayloadSupported(bindingContext.getHttpRequest().getMethod()) && msg.getBody() != null) {
msg = invokeRequest(bindingContext, msg);
}
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (binding.getResponseWireFormat() instanceof XMLWireFormat) {
msg = invokeResponse(bindingContext, msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-rest-runtime
public Message invoke(Message msg) {
HTTPContext bindingContext = (HTTPContext) msg.getBindingContext();
if (bindingContext == null) {
return getNext().invoke(msg);
}
if (binding.getRequestWireFormat() instanceof JSONWireFormat) {
if( isPayloadSupported(bindingContext.getHttpRequest().getMethod()) && msg.getBody() != null) {
msg = invokeRequest(bindingContext, msg);
}
}
msg = getNext().invoke(msg);
//if it's oneway return back
Operation operation = msg.getOperation();
if (operation != null && operation.isNonBlocking()) {
return msg;
}
if (binding.getResponseWireFormat() instanceof JSONWireFormat) {
msg = invokeResponse(bindingContext, msg);
}
return msg;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2
public Message invoke(Message msg) {
try {
Object resp = null;
if (msg.getOperation().isNonBlocking()) {
resp = invokeTargetOneWay(msg);
} else {
resp = invokeTarget(msg);
}
msg.setBody(resp);
} catch (AxisFault e) {
if (e.getDetail() != null ) {
FaultException f = new FaultException(e.getMessage(), e.getDetail(), e);
f.setFaultName(e.getDetail().getQName());
msg.setFaultBody(f);
} else {
msg.setFaultBody(e);
}
} catch (Throwable e) {
msg.setFaultBody(e);
}
return msg;
}
内容来源于网络,如有侵权,请联系作者删除!