当前位置: 首页>>代码示例>>Java>>正文


Java Exchange.put方法代码示例

本文整理汇总了Java中org.apache.cxf.message.Exchange.put方法的典型用法代码示例。如果您正苦于以下问题:Java Exchange.put方法的具体用法?Java Exchange.put怎么用?Java Exchange.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cxf.message.Exchange的用法示例。


在下文中一共展示了Exchange.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMessage

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public void handleMessage(Message message) throws Fault
{
   if (binding != null) {
      Exchange ex = message.getExchange();
      if (ex.get(HandlerChainInvoker.class) == null) {
         List<Handler> hc = binding.getHandlerChain();
         if (hc.size() > 1) { //no need to sort etc if the chain is empty or has one handler only
            Collections.sort(hc, comparator);
            //install a new HandlerChainInvoker using the sorted handler chain;
            //the AbstractJAXWSHandlerInterceptor will be using this invoker
            //instead of creating a new one
            ex.put(HandlerChainInvoker.class, new HandlerChainInvoker(hc, isOutbound(message, ex)));
         }
      }
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:19,代码来源:HandlerChainSortInterceptor.java

示例2: handleMessage

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
   final Exchange ex = message.getExchange();
   HandlerChainInvoker invoker = ex.get(HandlerChainInvoker.class);
   if (null == invoker)
   {
      final org.apache.cxf.endpoint.Endpoint endpoint = ex.getEndpoint();
      if (endpoint instanceof JaxWsEndpointImpl) { // JAXWS handlers are not assigned to different endpoint types 
         final JaxWsEndpointImpl ep = (JaxWsEndpointImpl)endpoint;
         @SuppressWarnings("rawtypes")
         final List<Handler> handlerChain = ep.getJaxwsBinding().getHandlerChain();
         if (handlerChain != null && !handlerChain.isEmpty()) { //save
            invoker = new JBossWSHandlerChainInvoker(handlerChain, isOutbound(message, ex));
            ex.put(HandlerChainInvoker.class, invoker);
         }
      }
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:20,代码来源:HandlerAuthInterceptor.java

示例3: getTestExchange

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private Exchange getTestExchange() {
   Exchange exchange = new ExchangeImpl();
   Message message = new MessageImpl();
   message.setExchange(exchange);
   exchange.setInMessage(message);
   exchange.put(BindingOperationInfo.class, new BindingOperationInfo());
   Service service = new ServiceImpl();
   MethodDispatcher md = new MethodDispatcher() {
      @Override
      public Method getMethod(BindingOperationInfo op) {
         return this.getClass().getMethods()[0];
      }
      @Override
      public BindingOperationInfo getBindingOperation(Method m, Endpoint endpoint) {
         return null;
      }
      @Override
      public void bind(OperationInfo o, Method... methods) {
      }
   };
   service.put(MethodDispatcher.class.getName(), md);
   exchange.put(Service.class, service);
   return exchange;
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:25,代码来源:JBossWSInvokerTest.java

示例4: buildTxId

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Nullable
public static String buildTxId(Exchange exchange, Message msg, RestEvent event, String propName) {
    if (msg.containsKey(propName)) {
        return SdcctWsPropertyUtils.getProperty(msg, propName);
    }

    String txId = null;

    if (exchange.containsKey(propName)) {
        txId = SdcctWsPropertyUtils.getProperty(exchange, propName);
    } else if (event.getEventType() == RestEventType.REQUEST) {
        exchange.put(propName, (txId = MDC.get(propName)));
    }

    if (txId != null) {
        msg.put(propName, txId);

        event.setTxId(txId);
    }

    return txId;
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:23,代码来源:SdcctLoggingFeature.java

示例5: validate

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
public ValidatorReport validate(Attachment docAttachment, String testcaseId) throws Exception {
    Exchange exchange = JAXRSUtils.getCurrentMessage().getExchange();

    ValidatorSubmission submission = new ValidatorSubmissionImpl();
    exchange.put(ValidatorSubmission.class, submission);

    ValidatorDocument doc = new ValidatorDocumentImpl();
    submission.setDocument(doc);
    submission.setTestcaseId(testcaseId);

    doc.setFileName(CrigttFileUtils.buildSafeFileName(docAttachment.getContentDisposition().getParameter(ContentDispositionParameters.FILENAME)));

    try (InputStream docInStream = docAttachment.getDataHandler().getInputStream()) {
        doc.setContent(IOUtils.toByteArray(docInStream));
    }

    return this.validatorService.validate(submission);
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:19,代码来源:ValidatorWebServiceImpl.java

示例6: setExchangeProperties

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
protected void setExchangeProperties(Exchange exchange, Endpoint ep) {
    if (ep != null) {
        exchange.put(Endpoint.class, ep);
        exchange.put(Service.class, ep.getService());
        if (ep.getEndpointInfo().getService() != null) {
            exchange.put(ServiceInfo.class, ep.getEndpointInfo()
                    .getService());
            exchange.put(InterfaceInfo.class, ep.getEndpointInfo()
                    .getService().getInterface());
        }
        exchange.put(Binding.class, ep.getBinding());
        exchange.put(BindingInfo.class, ep.getEndpointInfo().getBinding());
    }

    exchange.put(MessageObserver.class, this);
    exchange.put(Bus.class, getBus());
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:18,代码来源:ProtobufClient.java

示例7: handleMessage

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
   Endpoint endpoint = EndpointAssociation.getEndpoint();
   Exchange exchange = message.getExchange();
   exchange.put(Endpoint.class, endpoint);
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:8,代码来源:EndpointAssociationInterceptor.java

示例8: setMessage

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private MessageInfo setMessage(Message message, BindingOperationInfo operation,
                               boolean requestor, ServiceInfo si) {
    MessageInfo msgInfo = getMessageInfo(message, operation, requestor);
    message.put(MessageInfo.class, msgInfo);

    Exchange ex = message.getExchange();
    ex.put(BindingOperationInfo.class, operation);
    ex.put(OperationInfo.class, operation.getOperationInfo());
    ex.setOneWay(operation.getOperationInfo().isOneWay());

    //Set standard MessageContext properties required by JAX_WS, but not specific to JAX_WS.
    message.put(Message.WSDL_OPERATION, operation.getName());

    QName serviceQName = si.getName();
    message.put(Message.WSDL_SERVICE, serviceQName);

    QName interfaceQName = si.getInterface().getName();
    message.put(Message.WSDL_INTERFACE, interfaceQName);

    EndpointInfo endpointInfo = ex.get(Endpoint.class).getEndpointInfo();
    QName portQName = endpointInfo.getName();
    message.put(Message.WSDL_PORT, portQName);

    
    URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
    if (wsdlDescription == null) {
        String address = endpointInfo.getAddress();
        try {
            wsdlDescription = new URI(address + "?wsdl");
        } catch (URISyntaxException e) {
            //do nothing
        }
        endpointInfo.setProperty("URI", wsdlDescription);
    }
    message.put(Message.WSDL_DESCRIPTION, wsdlDescription);

    return msgInfo;
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:39,代码来源:DocLiteralInInterceptor.java

示例9: getBindingOperationInfo

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
protected BindingOperationInfo getBindingOperationInfo(Exchange exchange, QName name,
                                                       boolean client) {
    BindingOperationInfo bop = ServiceModelUtil.getOperationForWrapperElement(exchange, name, client);
    if (bop == null) {
        bop = super.getBindingOperationInfo(exchange, name, client);
    }
        
    if (bop != null) {
        exchange.put(BindingOperationInfo.class, bop);
        exchange.put(OperationInfo.class, bop.getOperationInfo());
    }
    return bop;
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:14,代码来源:DocLiteralInInterceptor.java

示例10: performFailover

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private boolean performFailover(Exchange exchange, InvocationContext invocation) {
	Exception prevExchangeFault = (Exception) exchange.remove(Exception.class.getName());
	Message outMessage = exchange.getOutMessage();
	Exception prevMessageFault = outMessage.getContent(Exception.class);
	outMessage.setContent(Exception.class, null);
	overrideAddressProperty(invocation.getContext());
	Retryable retry = exchange.get(Retryable.class);
	exchange.clear();
	boolean failover = false;
	if (retry != null) {
		try {
			failover = true;
			long delay = getDelayBetweenRetries();
			if (delay > 0) {
				Thread.sleep(delay);
			}
			Map<String, Object> context = invocation.getContext();
			retry.invoke(invocation.getBindingOperationInfo(), invocation.getParams(), context,
					exchange);
		} catch (Exception e) {
			if (exchange.get(Exception.class) != null) {
				exchange.put(Exception.class, prevExchangeFault);
			}
			if (outMessage.getContent(Exception.class) != null) {
				outMessage.setContent(Exception.class, prevMessageFault);
			}
		}
	}
	return failover;
}
 
开发者ID:jaceko,项目名称:cxf-circuit-switcher,代码行数:31,代码来源:CircuitSwitcherTargetSelector.java

示例11: setExchangeFinished

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
public static void setExchangeFinished(Exchange exchange) {
    synchronized (exchange) {
        if (!isExchangeFinished(exchange)) {
            exchange.put(ClientImpl.FINISHED, Boolean.TRUE);
            exchange.notifyAll();
        }
    }
}
 
开发者ID:ow2-chameleon,项目名称:fuchsia,代码行数:9,代码来源:ExchangeUtils.java

示例12: prepareCamelExchange

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private org.apache.camel.Exchange prepareCamelExchange(Exchange cxfExchange) {
    // get CXF binding
    CxfEndpoint endpoint = (CxfEndpoint)getEndpoint();
    CxfBinding binding = endpoint.getCxfBinding();

    // create a Camel exchange, the default MEP is InOut
    org.apache.camel.Exchange camelExchange = endpoint.createExchange();

    DataFormat dataFormat = endpoint.getDataFormat();

    BindingOperationInfo boi = cxfExchange.getBindingOperationInfo();
    // make sure the "boi" is remained as wrapped in PAYLOAD mode
    if (boi != null && dataFormat == DataFormat.PAYLOAD && boi.isUnwrapped()) {
        boi = boi.getWrappedOperation();
        cxfExchange.put(BindingOperationInfo.class, boi);
    }

    if (boi != null) {
        camelExchange.setProperty(BindingOperationInfo.class.getName(), boi);
        LOG.trace("Set exchange property: BindingOperationInfo: {}", boi);
        // set the message exchange patter with the boi
        if (boi.getOperationInfo().isOneWay()) {
            camelExchange.setPattern(ExchangePattern.InOnly);
        }
    } else {
        if (cxfEndpoint.getExchangePattern().equals(ExchangePattern.InOnly)) {
            camelExchange.setPattern(ExchangePattern.InOnly);
        }
    }


    // set data format mode in Camel exchange
    camelExchange.setProperty(CxfConstants.DATA_FORMAT_PROPERTY, dataFormat);
    LOG.trace("Set Exchange property: {}={}", DataFormat.class.getName(), dataFormat);

    camelExchange.setProperty(Message.MTOM_ENABLED, String.valueOf(endpoint.isMtomEnabled()));

    if (endpoint.getMergeProtocolHeaders()) {
        camelExchange.setProperty(CxfConstants.CAMEL_CXF_PROTOCOL_HEADERS_MERGED, Boolean.TRUE);
    }
    // bind the CXF request into a Camel exchange
    binding.populateExchangeFromCxfRequest(cxfExchange, camelExchange);
    // extract the javax.xml.ws header
    Map<String, Object> context = new HashMap<String, Object>();
    binding.extractJaxWsContext(cxfExchange, context);
    // put the context into camelExchange
    camelExchange.setProperty(CxfConstants.JAXWS_CONTEXT, context);

    // we want to handle the UoW
    try {
        CxfConsumer.this.createUoW(camelExchange);
    } catch (Exception e) {
        log.error("Error processing request", e);
        throw new Fault(e);
    }
    return camelExchange;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:58,代码来源:CxfConsumer.java

示例13: handleMessage

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public void handleMessage(Message message) throws Fault
{
   Exchange exchange = message.getExchange();
   exchange.put(Provider.class, Holder.provider);
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:7,代码来源:SecurityProviderConfig.java

示例14: call

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
@Override
public SOAPMessage call(SOAPMessage msgOut, Object addressObject) throws SOAPException 
{
   checkClosed();
   
   String address = getAddress(addressObject);
   ConduitInitiator ci = getConduitInitiator(address);
    
    
   // create a new Message and Exchange
   EndpointInfo info = new EndpointInfo();
   info.setAddress(address);
   Message outMessage = new MessageImpl();
   Exchange exch = new ExchangeImpl();
   outMessage.setExchange(exch);
   exch.put("org.apache.cxf.transport.process_fault_on_http_400", true); //JBWS-3945
    
   // sent SOAPMessage
   try 
   {
      final Conduit c = ci.getConduit(info, BusFactory.getThreadDefaultBus(false)); //TODO verify bus

      if (msgOut.saveRequired())
      {
         msgOut.saveChanges();
      }
    
      Map<String, List<String>> outHeaders = new HashMap<String, List<String>>();
      for (Iterator<?> it = msgOut.getMimeHeaders().getAllHeaders(); it.hasNext();) 
      {
         MimeHeader mimeHeader = (MimeHeader)it.next();
         if ("Content-Type".equals(mimeHeader.getName())) 
         {
            outMessage.put(Message.CONTENT_TYPE, mimeHeader.getValue());
         }
            
         // disable the chunked encoding if requested
         if ("Transfer-Encoding".equals(mimeHeader.getName())
             && "disabled".equals(mimeHeader.getValue())
             && c instanceof HTTPConduit) 
         {
            ((HTTPConduit)c).getClient().setAllowChunking(false);
            continue;
         }
            
         List<String> values = outHeaders.get(mimeHeader.getName());
         if (values == null) 
         {
            values = new ArrayList<String>();
            outHeaders.put(mimeHeader.getName(), values);
         } 
         values.add(mimeHeader.getValue());
      }
      outMessage.put(Message.HTTP_REQUEST_METHOD, "POST");
      outMessage.put(Message.PROTOCOL_HEADERS, outHeaders);
      c.prepare(outMessage);
        
      OutputStream outs = outMessage.getContent(OutputStream.class);
      msgOut.writeTo(outs);
        
      c.setMessageObserver(createMessageObserver(c));
        
      c.close(outMessage);
   } 
   catch (Exception ex) 
   {
      throw MESSAGES.soapMessageCouldNotBeSent(ex);
   }    

   // read SOAPMessage        
   return readSoapMessage(exch); 
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:73,代码来源:SOAPConnectionImpl.java

示例15: messageTo

import org.apache.cxf.message.Exchange; //导入方法依赖的package包/类
private Message messageTo(String requestBaseURL, String requestPath) {
	Message message = new SoapMessage(Soap11.getInstance());
	String requestURL = requestBaseURL + requestPath;
	message.put(Message.ENDPOINT_ADDRESS, requestURL);
	message.put(Message.BASE_PATH, requestBaseURL);
	message.put(Message.REQUEST_URI, requestURL);

	HashMap<String, Object> ctx = new HashMap<String, Object>();
	ctx.put(Client.REQUEST_CONTEXT, new HashMap<String, Object>());
	message.put(Message.INVOCATION_CONTEXT, ctx);

	CXFBusImpl bus = new CXFBusImpl();
	BindingFactoryManagerImpl bindingFactoryManager = new BindingFactoryManagerImpl();
	bindingFactoryManager.registerBindingFactory("abc", new JAXRSBindingFactory());
	bus.setExtension(bindingFactoryManager, BindingFactoryManager.class);
	Map<String, ConduitInitiator> conduitInitiators = new HashMap<String, ConduitInitiator>();
	ConduitInitiator ci = new HTTPTransportFactory(bus);
	conduitInitiators.put(ENDPOINT_TRANSPORT_ID, ci);
	ConduitInitiatorManagerImpl cim = new ConduitInitiatorManagerImpl(conduitInitiators);
	bus.setExtension(cim, ConduitInitiatorManager.class);

	Exchange exchange = exchange(message);
	exchange.put(Bus.class, bus);
	EndpointInfo ei = new EndpointInfo();
	ei.setAddress("http://abc123");
	BindingInfo b = new BindingInfo(null, "abc");
	ei.setBinding(b);
	Endpoint endpointMock = mock(Endpoint.class);
	when(endpointMock.getEndpointInfo()).thenReturn(ei);
	exchange.put(Endpoint.class, endpointMock);

	message.setExchange(exchange);
	message.setContent(List.class, new ArrayList<String>());
	circuitBreakerTargetSelector.prepare(message);

	InvocationKey key = new InvocationKey(exchange);
	InvocationContext invocation = circuitBreakerTargetSelector.getInvocation(key);

	invocation.getContext().put(Message.ENDPOINT_ADDRESS, requestPath);
	invocation.getContext().put("org.apache.cxf.request.uri", requestPath);
	return message;
}
 
开发者ID:jaceko,项目名称:cxf-circuit-switcher,代码行数:43,代码来源:CircuitSwitcherTargetSelectorTest.java


注:本文中的org.apache.cxf.message.Exchange.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。