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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

  1. public void initializeAttachments() throws IOException {
  2. initializeRootMessage();
  3. attachments = new LazyAttachmentCollection(this);
  4. message.setAttachments(attachments);
  5. }

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

  1. public void initializeAttachments() throws IOException {
  2. initializeRootMessage();
  3. attachments = new LazyAttachmentCollection(this);
  4. message.setAttachments(attachments);
  5. }

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

  1. public void initializeAttachments() throws IOException {
  2. initializeRootMessage();
  3. attachments = new LazyAttachmentCollection(this);
  4. message.setAttachments(attachments);
  5. }

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

  1. public void initializeAttachments() throws IOException {
  2. initializeRootMessage();
  3. attachments = new LazyAttachmentCollection(this);
  4. message.setAttachments(attachments);
  5. }

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

  1. public void handleMessage(Message message) throws Fault
  2. {
  3. MuleEvent event = (MuleEvent) message.getExchange().get(CxfConstants.MULE_EVENT);
  4. if (event == null || event instanceof NonBlockingVoidMuleEvent)
  5. {
  6. return;
  7. }
  8. Collection<Attachment> a = event.getMessage().getInvocationProperty(CxfConstants.ATTACHMENTS);
  9. if (a != null)
  10. {
  11. message.setAttachments(a);
  12. }
  13. }
  14. }

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

  1. /**
  2. * Copy NormalizedMessage attachments to SoapMessage attachments
  3. */
  4. private void fromNMSAttachments(Message message,
  5. NormalizedMessage normalizedMessage) {
  6. Set attachmentNames = normalizedMessage.getAttachmentNames();
  7. Collection<Attachment> attachmentList = new ArrayList<Attachment>();
  8. for (Iterator it = attachmentNames.iterator(); it.hasNext();) {
  9. String id = (String) it.next();
  10. DataHandler handler = normalizedMessage.getAttachment(id);
  11. Attachment attachment = new AttachmentImpl(id, handler);
  12. attachmentList.add(attachment);
  13. }
  14. message.setAttachments(attachmentList);
  15. if (message instanceof SoapMessage) {
  16. SoapMessage soapMessage = (SoapMessage)message;
  17. SoapVersion soapVersion = soapMessage.getVersion();
  18. message.put(Message.CONTENT_TYPE, soapVersion.getContentType());
  19. }
  20. if (attachmentList.size() > 0) {
  21. message.put(org.apache.cxf.message.Message.MTOM_ENABLED, true);
  22. message.put("write.attachments", true);
  23. message.getInterceptorChain().add(new AttachmentOutInterceptor());
  24. }
  25. }

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

  1. protected <T> DataWriter<T> getDataWriter(Message message, Service service, Class<T> output) {
  2. DataWriter<T> writer = service.getDataBinding().createWriter(output);
  3. Collection<Attachment> atts = message.getAttachments();
  4. if (MessageUtils.getContextualBoolean(message, Message.MTOM_ENABLED, false)
  5. && atts == null) {
  6. atts = new ArrayList<>();
  7. message.setAttachments(atts);
  8. }
  9. writer.setAttachments(atts);
  10. writer.setProperty(DataWriter.ENDPOINT, message.getExchange().getEndpoint());
  11. writer.setProperty(Message.class.getName(), message);
  12. setDataWriterValidation(service, message, writer);
  13. return writer;
  14. }

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

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

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

  1. protected <T> DataWriter<T> getDataWriter(Message message, Service service, Class<T> output) {
  2. DataWriter<T> writer = service.getDataBinding().createWriter(output);
  3. Collection<Attachment> atts = message.getAttachments();
  4. if (MessageUtils.getContextualBoolean(message, Message.MTOM_ENABLED, false)
  5. && atts == null) {
  6. atts = new ArrayList<>();
  7. message.setAttachments(atts);
  8. }
  9. writer.setAttachments(atts);
  10. writer.setProperty(DataWriter.ENDPOINT, message.getExchange().getEndpoint());
  11. writer.setProperty(Message.class.getName(), message);
  12. setDataWriterValidation(service, message, writer);
  13. return writer;
  14. }

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

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

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

  1. protected <T> DataWriter<T> getDataWriter(Message message, Service service, Class<T> output) {
  2. DataWriter<T> writer = service.getDataBinding().createWriter(output);
  3. Collection<Attachment> atts = message.getAttachments();
  4. if (MessageUtils.isTrue(message.getContextualProperty(
  5. org.apache.cxf.message.Message.MTOM_ENABLED))
  6. && atts == null) {
  7. atts = new ArrayList<Attachment>();
  8. message.setAttachments(atts);
  9. }
  10. writer.setAttachments(atts);
  11. writer.setProperty(DataWriter.ENDPOINT, message.getExchange().getEndpoint());
  12. writer.setProperty(Message.class.getName(), message);
  13. setDataWriterValidation(service, message, writer);
  14. return writer;
  15. }

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

  1. public void handleMessage(Message message) {
  2. List<Attachment> attachmentList = new ArrayList<Attachment>();
  3. MessageExchange exchange = message.get(MessageExchange.class);
  4. NormalizedMessage norMessage = null;
  5. if (isRequestor(message)) {
  6. norMessage = (NormalizedMessage) exchange.getMessage("out");
  7. } else {
  8. norMessage = (NormalizedMessage) exchange.getMessage("in");
  9. }
  10. if (norMessage == null) {
  11. norMessage = (NormalizedMessage) exchange.getFault();
  12. }
  13. if (norMessage ==null) {
  14. return;
  15. }
  16. Set names = norMessage.getAttachmentNames();
  17. for (Object obj : names) {
  18. String id = (String)obj;
  19. DataHandler dh = norMessage.getAttachment(id);
  20. attachmentList.add(new AttachmentImpl(id, dh));
  21. }
  22. message.setAttachments(attachmentList);
  23. }

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

  1. protected <T> DataWriter<T> getDataWriter(Message message, Service service, Class<T> output) {
  2. DataWriter<T> writer = service.getDataBinding().createWriter(output);
  3. Collection<Attachment> atts = message.getAttachments();
  4. if (MessageUtils.isTrue(message.getContextualProperty(
  5. org.apache.cxf.message.Message.MTOM_ENABLED))
  6. && atts == null) {
  7. atts = new ArrayList<Attachment>();
  8. message.setAttachments(atts);
  9. }
  10. writer.setAttachments(atts);
  11. writer.setProperty(DataWriter.ENDPOINT, message.getExchange().getEndpoint());
  12. writer.setProperty(Message.class.getName(), message);
  13. setDataWriterValidation(service, message, writer);
  14. return writer;
  15. }

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

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

相关文章