當前位置: 首頁>>代碼示例>>Java>>正文


Java Message.getAttachments方法代碼示例

本文整理匯總了Java中org.apache.cxf.message.Message.getAttachments方法的典型用法代碼示例。如果您正苦於以下問題:Java Message.getAttachments方法的具體用法?Java Message.getAttachments怎麽用?Java Message.getAttachments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.cxf.message.Message的用法示例。


在下文中一共展示了Message.getAttachments方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDataWriter

import org.apache.cxf.message.Message; //導入方法依賴的package包/類
protected <T> DataWriter<T> getDataWriter(Message message, Service service, Class<T> output) {
    DataWriter<T> writer = service.getDataBinding().createWriter(output);
    
    Collection<Attachment> atts = message.getAttachments();
    if (MessageUtils.isTrue(message.getContextualProperty(Message.MTOM_ENABLED))
          && atts == null) {
        atts = new ArrayList<Attachment>();
        message.setAttachments(atts);
    }
    
    writer.setAttachments(atts);
    writer.setProperty(DataWriter.ENDPOINT, message.getExchange().getEndpoint());
    writer.setProperty(Message.class.getName(), message);
    
    setDataWriterValidation(service, message, writer);
    return writer;
}
 
開發者ID:Huawei,項目名稱:eSDK_EC_SDK_Java,代碼行數:18,代碼來源:AbstractOutDatabindingInterceptor.java

示例2: populateExchangeFromCxfResponse

import org.apache.cxf.message.Message; //導入方法依賴的package包/類
/**
 * This method is called by {@link CxfProducer#process(Exchange)}.  It propagates 
 * information from CXF Exchange to Camel Exchange.  The CXF Exchange contains a 
 * request from a CXF server.
 */
public void populateExchangeFromCxfResponse(Exchange camelExchange,
        org.apache.cxf.message.Exchange cxfExchange, 
        Map<String, Object> responseContext) {
  
    Message cxfMessage = cxfExchange.getInMessage();
    // Need to check if the inMessage is set
    if (cxfMessage == null) {
        return;
    }
    
    LOG.trace("Populate exchange from CXF response message: {}", cxfMessage);

    // copy the InMessage header to OutMessage header
    camelExchange.getOut().getHeaders().putAll(camelExchange.getIn().getHeaders());
    
    // propagate body
    String encoding = (String)camelExchange.getProperty(Exchange.CHARSET_NAME);
    camelExchange.getOut().setBody(DefaultCxfBinding.getContentFromCxf(cxfMessage, 
            camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY, DataFormat.class), encoding));
    
    // propagate response context
    if (responseContext != null && responseContext.size() > 0) {
        if (!headerFilterStrategy.applyFilterToExternalHeaders(Client.RESPONSE_CONTEXT, 
                                                               responseContext, camelExchange)) {        
            camelExchange.getOut().setHeader(Client.RESPONSE_CONTEXT, responseContext);
            LOG.trace("Set header = {} value = {}", Client.RESPONSE_CONTEXT, responseContext);
        }
    }
    
    // propagate protocol headers
    propagateHeadersFromCxfToCamel(cxfMessage, camelExchange.getOut(), camelExchange);
    DataFormat dataFormat = camelExchange.getProperty(CxfConstants.DATA_FORMAT_PROPERTY,  
                                                      DataFormat.class);
    boolean isXop = Boolean.valueOf(camelExchange.getProperty(Message.MTOM_ENABLED, String.class));
    // propagate attachments
    if (cxfMessage.getAttachments() != null) {
        // propagate attachments
        for (Attachment attachment : cxfMessage.getAttachments()) {
            camelExchange.getOut().addAttachment(attachment.getId(), attachment.getDataHandler());
        }        
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:48,代碼來源:DefaultCxfBinding.java


注:本文中的org.apache.cxf.message.Message.getAttachments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。