org.apache.cxf.message.Message.setAttachments()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(152)

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

Message.setAttachments介绍

暂无

代码示例

代码示例来源:origin: org.apache.cxf/cxf-core

public void setAttachments(Collection<Attachment> attachments) {
  message.setAttachments(attachments);
}

代码示例来源:origin: apache/cxf

public void setAttachments(Collection<Attachment> attachments) {
  message.setAttachments(attachments);
}

代码示例来源:origin: org.apache.cxf/cxf-api

public void setAttachments(Collection<Attachment> attachments) {
  message.setAttachments(attachments);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public void setAttachments(Collection<Attachment> attachments) {
  message.setAttachments(attachments);
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

throw new Fault(ex);
message.setAttachments(msg.getAttachments());
final InputStream in = msg.getContent(InputStream.class);
final String ct2 = (String)msg.get(Message.CONTENT_TYPE);

代码示例来源:origin: org.mule.services/mule-service-soap

private void addAttachments(Message message) {
 Map<String, Attachment> soapAttachments = (Map<String, Attachment>) message.getExchange().get(MULE_ATTACHMENTS_KEY);
 message.setAttachments(soapAttachments.values());
}

代码示例来源:origin: org.apache.cxf/cxf-core

public void initializeAttachments() throws IOException {
  initializeRootMessage();
  attachments = new LazyAttachmentCollection(this);
  message.setAttachments(attachments);
}

代码示例来源:origin: apache/cxf

public void initializeAttachments() throws IOException {
  initializeRootMessage();
  attachments = new LazyAttachmentCollection(this);
  message.setAttachments(attachments);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

public void initializeAttachments() throws IOException {
  initializeRootMessage();
  attachments = new LazyAttachmentCollection(this);
  message.setAttachments(attachments);
}

代码示例来源:origin: org.apache.cxf/cxf-api

public void initializeAttachments() throws IOException {
  initializeRootMessage();
  attachments = new LazyAttachmentCollection(this);
  message.setAttachments(attachments);
}

代码示例来源:origin: org.mule.modules/mule-module-cxf

public void handleMessage(Message message) throws Fault
  {
    MuleEvent event = (MuleEvent) message.getExchange().get(CxfConstants.MULE_EVENT);

    if (event == null || event instanceof NonBlockingVoidMuleEvent)
    {
      return;
    }

    Collection<Attachment> a = event.getMessage().getInvocationProperty(CxfConstants.ATTACHMENTS);
    
    if (a != null) 
    {
      message.setAttachments(a);
    }
  }
}

代码示例来源:origin: org.apache.servicemix/servicemix-cxf-bc

/**
 * Copy NormalizedMessage attachments to SoapMessage attachments
 */
private void fromNMSAttachments(Message message,
    NormalizedMessage normalizedMessage) {
  Set attachmentNames = normalizedMessage.getAttachmentNames();
  Collection<Attachment> attachmentList = new ArrayList<Attachment>();
  for (Iterator it = attachmentNames.iterator(); it.hasNext();) {
    String id = (String) it.next();
    DataHandler handler = normalizedMessage.getAttachment(id);
    Attachment attachment = new AttachmentImpl(id, handler);
    attachmentList.add(attachment);
  }
  message.setAttachments(attachmentList);
  
  if (message instanceof SoapMessage) {
    SoapMessage soapMessage = (SoapMessage)message;
    SoapVersion soapVersion = soapMessage.getVersion();
    message.put(Message.CONTENT_TYPE, soapVersion.getContentType());
  }
  if (attachmentList.size() > 0) {
    message.put(org.apache.cxf.message.Message.MTOM_ENABLED, true);
    message.put("write.attachments", true);
    message.getInterceptorChain().add(new AttachmentOutInterceptor());
  }
  
}

代码示例来源:origin: org.apache.cxf/cxf-core

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.getContextualBoolean(message, Message.MTOM_ENABLED, false)
     && atts == null) {
    atts = new ArrayList<>();
    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;
}

代码示例来源:origin: apache/cxf

outMessage.setAttachments(atts);
outMessage.put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, "true");
Attachment root = (Attachment)handlers.get(0);

代码示例来源:origin: apache/cxf

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.getContextualBoolean(message, Message.MTOM_ENABLED, false)
     && atts == null) {
    atts = new ArrayList<>();
    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;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

outMessage.setAttachments(atts);
outMessage.put(AttachmentOutInterceptor.WRITE_ATTACHMENTS, "true");
Attachment root = (Attachment)handlers.get(0);

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

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(
     org.apache.cxf.message.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;
}

代码示例来源:origin: org.apache.servicemix/servicemix-cxf-se

public void handleMessage(Message message) {
  List<Attachment> attachmentList = new ArrayList<Attachment>();
  MessageExchange exchange = message.get(MessageExchange.class);
  NormalizedMessage norMessage = null;
  if (isRequestor(message)) {
    norMessage = (NormalizedMessage) exchange.getMessage("out");
  } else { 
    norMessage = (NormalizedMessage) exchange.getMessage("in");
  }
  if (norMessage == null) {
    norMessage = (NormalizedMessage) exchange.getFault();
  }
  if (norMessage ==null) {
    return;
  }
  Set names = norMessage.getAttachmentNames();
  for (Object obj : names) {
    String id = (String)obj;
    DataHandler dh = norMessage.getAttachment(id);
    attachmentList.add(new AttachmentImpl(id, dh));
  }
  
  message.setAttachments(attachmentList);
}

代码示例来源:origin: org.apache.cxf/cxf-api

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(
     org.apache.cxf.message.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;
}

代码示例来源:origin: org.mule.services/mule-service-soap

/**
 * {@inheritDoc}
 * <p>
 * Intercepts the SOAP message and performs the dispatch of it, receiving the response and
 * sending it to the IN intercepting processor chain.
 */
@Override
public void handleMessage(Message message) throws Fault {
 Exchange exchange = message.getExchange();
 Object encoding = exchange.get(ENCODING);
 message.put(ENCODING, encoding);
 // Performs all the remaining interceptions before sending.
 message.getInterceptorChain().doIntercept(message);
 // Wipe the request attachment list, so don't get mixed with the response ones.
 message.setAttachments(emptyList());
 MessageDispatcher dispatcher = (MessageDispatcher) exchange.get(MESSAGE_DISPATCHER);
 DispatchingResponse response = dispatcher.dispatch(getDispatchingRequest(message));
 // This needs to be set because we want the wsc closes the final stream,
 // otherwise cxf will close it too early when handling message in the StaxInEndingInterceptor.
 exchange.put(STAX_IN_NOCLOSE, TRUE);
 if (OperationType.ONE_WAY.equals(exchange.get(MULE_SOAP_OPERATION_STYLE))) {
  exchange.put(ClientImpl.FINISHED, true);
 } else {
  handleRequestResponse(exchange, encoding, response);
 }
}

相关文章