org.apache.tuscany.sca.invocation.Message.getBindingContext()方法的使用及代码示例

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

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

Message.getBindingContext介绍

[英]Returns the binding context in force for this message
[中]返回此消息的有效绑定上下文

代码示例

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-http-runtime

private Message invokeResponse(Message msg) throws IOException {
  HTTPContext context = msg.getBindingContext();
  HttpServletRequest servletRequest = context.getHttpRequest();
  HttpServletResponse servletResponse = context.getHttpResponse();
  
  if (msg.isFault()) {            
    servletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, String.valueOf(msg.getBody()));
  } else {
    String response = getResponseAsString(servletRequest, servletResponse, msg.getBody());
    servletResponse.getOutputStream().println(response);
  }
  
  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-binding-http-runtime

@Override
public Message invoke(Message msg) {
  HTTPContext context = msg.getBindingContext();
  HttpServletRequest request = context.getHttpRequest();
  String path = request.getPathInfo();
  if (path.startsWith("/")) {
    path = path.substring(1);
  }
  for (Operation op : operations) {
    if (op.getName().equals(path)) {
      msg.setOperation(op);
      return next.invoke(msg);
    }
  }
  
  throw new ServiceRuntimeException("No matching operation: " + path);
}

代码示例来源: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 invoke(Message msg) {
    // get the jms context
    JMSBindingContext context = msg.getBindingContext();
    javax.jms.Message jmsMsg = msg.getBody();

    // JMS header attrs set on MessageProducer via interceptors.
          
    return getNext().invoke(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();
        Operation operation = getTargetOperation(jmsMsg);
    msg.setOperation(operation);
    return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2

protected Object invokeTargetOneWay(Message msg) throws AxisFault {
  WSAxis2BindingContext bindingContext = msg.getBindingContext();
  OperationClient operationClient = bindingContext.getAxisOperationClient();
  // ensure connections are tracked so that they can be closed by the reference binding
  MessageContext requestMC = operationClient.getMessageContext("Out");
  //requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
  Options opt = requestMC.getOptions();
  opt.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
  opt.setUseSeparateListener(true);
  opt.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,Boolean.TRUE);        
  operationClient.execute(false);
  // REVIEW it seems ok to return null
  return null;
}

代码示例来源: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-http-runtime

@Override
public Message invoke(Message msg) {
  HTTPContext context = msg.getBindingContext();
  HttpServletRequest request = context.getHttpRequest();
  
  Operation operation = findOperation(request.getMethod());
  if(operation == null) {
    operation = findOperation("service");
  }
  
  if(operation == null) {
    throw new ServiceRuntimeException("No matching operation for " + request.getMethod());
  }
  msg.setOperation(operation);
  return next.invoke(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();
    
    String operationName = requestMessageProcessor.getOperationName(jmsMsg);
    Operation operation = getTargetOperation(operationName, jmsMsg);
    msg.setOperation(operation);
    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-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-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-binding-jms-runtime

public Message invokeRequest(Message msg) {
  try {
    // get the jms context
    JMSBindingContext context = msg.getBindingContext();
    Session session = context.getJmsSession();
    
    Object[] requestParams = msg.getBody();
    javax.jms.Message requestMsg = null;
    if (requestParams != null && requestParams.length > 0 ){
      requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, requestParams[0]);
    } else {
      requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, null);
    }
    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 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-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;
}

相关文章