Codota Logo
Message.getAttachments
Code IndexAdd Codota to your IDE (free)

How to use
getAttachments
method
in
org.apache.cxf.message.Message

Best Java code snippets using org.apache.cxf.message.Message.getAttachments (Showing top 20 results out of 315)

  • Common ways to obtain Message
private void myMethod () {
Message m =
  • Codota IconPhaseInterceptorChain.getCurrentMessage()
  • Codota IconJAXRSUtils.getCurrentMessage()
  • Codota IconExchange exchange;exchange.getOutMessage()
  • Smart code suggestions by Codota
}
origin: org.apache.cxf/cxf-rt-frontend-jaxws

MultiPartDataSource(Message message, DataSource root) {
  atts = message.getAttachments().iterator();
  String s = (String)message.get(Message.CONTENT_TYPE);
  boundary = findBoundary(s);
  start = findStart(s);
  if (!s.contains(boundary)) {
    s += "; boundary=\"" + boundary + "\"";
  }
  contentType = s;
  rootPart = root;
  try {
    writer = new OutputStreamWriter(bout, "ASCII");
    writer.append("Content-Type: ").append(contentType).append("\r\n\r\n");
    writer.flush();
    current = bout.createInputStream();
  } catch (Exception e) {
    //nothing
  }
}
origin: org.apache.cxf/cxf-rt-frontend-jaxws

private void doDataSource(final Message message) {
  MessageContentsList list = (MessageContentsList)message.getContent(List.class);
  //reconstitute all the parts into a Mime data source
  if (message.getAttachments() != null && !message.getAttachments().isEmpty()
    && list != null
    && !list.isEmpty() && list.get(0) instanceof DataSource) {
    list.set(0, new MultiPartDataSource(message, (DataSource)list.get(0)));
  }
}
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.apache.servicemix/servicemix-cxf-bc

private void loadAttachments(Message message) {
  //get chance to cache the attachments
  if (message.getAttachments() != null) {
    LazyAttachmentCollection attachments = (LazyAttachmentCollection) message.getAttachments();
    attachments.size();
  }
}
origin: org.apache.servicemix/servicemix-cxf-bc

public void handleMessage(Message message) throws Fault {
  if (message.getAttachments() != null && message.getAttachments().size() > 0) {
    message.put(org.apache.cxf.message.Message.MTOM_ENABLED, mtomEnabled);
    message.put("write.attachments", mtomEnabled);
  }
}

origin: org.apache.cxf/cxf-rt-transports-http

DelegatingInputStream in = inMessage.getContent(DelegatingInputStream.class);
if (PropertyUtils.isTrue(o)) {
  Collection<Attachment> atts = inMessage.getAttachments();
  if (atts != null) {
    for (Attachment a : atts) {
origin: org.apache.servicemix/servicemix-cxf-bc

private void toNMSAttachments(NormalizedMessage normalizedMessage,
    Message soapMessage) throws MessagingException {
  if (soapMessage.getAttachments() != null) {
    for (Attachment att : soapMessage.getAttachments()) {
      normalizedMessage.addAttachment(att.getId(), att
          .getDataHandler());
    }
  }
}
origin: org.apache.servicemix/servicemix-cxf-bc

/**
 * Convert SoapMessage attachments to NormalizedMessage attachments
 */
private void toNMSAttachments(NormalizedMessage normalizedMessage,
    Message soapMessage) throws MessagingException {
  if (soapMessage.getAttachments() != null) {
    for (Attachment att : soapMessage.getAttachments()) {
      normalizedMessage.addAttachment(att.getId(), att
          .getDataHandler());
    }
  }
}
origin: apache/cxf

private void assertIsNotTextMessageAndMtom(final Message outMessage) {
  boolean isTextPayload = JMSConstants.TEXT_MESSAGE_TYPE.equals(jmsConfig.getMessageType());
  if (isTextPayload && MessageUtils.getContextualBoolean(outMessage, org.apache.cxf.message.Message.MTOM_ENABLED)
    && outMessage.getAttachments() != null && outMessage.getAttachments().size() > 0) {
    org.apache.cxf.common.i18n.Message msg =
      new org.apache.cxf.common.i18n.Message("INVALID_MESSAGE_TYPE", LOG);
    throw new ConfigurationException(msg);
  }
}
origin: org.mule.services/mule-service-soap

@Override
public void handleMessage(Message message) throws Fault {
 final ImmutableMap.Builder<String, SoapAttachment> result = ImmutableMap.builder();
 Collection<Attachment> attachments = message.getAttachments();
 if (attachments != null && !attachments.isEmpty()) {
  attachments.forEach(a -> result.put(getName(a), getSoapAttachment(a)));
 }
 message.getExchange().put(MULE_ATTACHMENTS_KEY, result.build());
}
origin: apache/cxf

private void doDataSource(final Message message) {
  MessageContentsList list = (MessageContentsList)message.getContent(List.class);
  //reconstitute all the parts into a Mime data source
  if (message.getAttachments() != null && !message.getAttachments().isEmpty()
    && list != null
    && !list.isEmpty() && list.get(0) instanceof DataSource) {
    list.set(0, new MultiPartDataSource(message, (DataSource)list.get(0)));
  }
}
origin: apache/cxf

  public void handleMessage(Message message) throws Fault {
    Assert.assertNotNull(message.getAttachments());
    Assert.assertEquals(1, message.getAttachments().size());
  }
}
origin: org.mule.modules/mule-module-cxf

public void handleMessage(Message message) throws Fault
{
  MuleEvent event = (MuleEvent) message.getExchange().get(CxfConstants.MULE_EVENT);
  MuleMessage muleMsg = event.getMessage();
  Collection<Attachment> atts = message.getAttachments();
  if (atts != null && !atts.isEmpty())
  {
    muleMsg.setInvocationProperty(CxfConstants.ATTACHMENTS, atts);
    muleMsg.setOutboundProperty(HttpConstants.HEADER_CONTENT_TYPE, muleMsg.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE));
  }
}
origin: apache/cxf

public void handleMessage(Message message) throws Fault {
  Assert.assertEquals("check attachment count", 1, message.getAttachments().size());
  Attachment att = message.getAttachments().iterator().next();
  Assert.assertNotNull("Attachment is null", att);
  Assert.assertNotNull("Attachment content-type is null", att.getDataHandler().getDataSource()
      .getContentType());
}
origin: apache/cxf

protected <T> DataReader<T> getDataReader(Message message, Class<T> input) {
  Service service = ServiceModelUtil.getService(message.getExchange());
  DataReader<T> dataReader = service.getDataBinding().createReader(input);
  if (dataReader == null) {
    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER",
                                BUNDLE, service.getName()));
  }
  dataReader.setAttachments(message.getAttachments());
  dataReader.setProperty(DataReader.ENDPOINT, message.getExchange().getEndpoint());
  dataReader.setProperty(Message.class.getName(), message);
  setDataReaderValidation(service, message, dataReader);
  return dataReader;
}
origin: apache/cxf

protected DataWriter<XMLStreamWriter> getDataWriter(Message message) {
  Service service = ServiceModelUtil.getService(message.getExchange());
  DataWriter<XMLStreamWriter> dataWriter = service.getDataBinding().createWriter(XMLStreamWriter.class);
  if (dataWriter == null) {
    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE, service
      .getName()));
  }
  dataWriter.setAttachments(message.getAttachments());
  setDataWriterValidation(service, message, dataWriter);
  return dataWriter;
}
private void setDataWriterValidation(Service service, Message message, DataWriter<?> writer) {
origin: org.apache.cxf/cxf-core

protected <T> DataReader<T> getDataReader(Message message, Class<T> input) {
  Service service = ServiceModelUtil.getService(message.getExchange());
  DataReader<T> dataReader = service.getDataBinding().createReader(input);
  if (dataReader == null) {
    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER",
                                BUNDLE, service.getName()));
  }
  dataReader.setAttachments(message.getAttachments());
  dataReader.setProperty(DataReader.ENDPOINT, message.getExchange().getEndpoint());
  dataReader.setProperty(Message.class.getName(), message);
  setDataReaderValidation(service, message, dataReader);
  return dataReader;
}
origin: org.apache.cxf/cxf-api

protected <T> DataReader<T> getDataReader(Message message, Class<T> input) {
  Service service = ServiceModelUtil.getService(message.getExchange());
  DataReader<T> dataReader = service.getDataBinding().createReader(input);
  if (dataReader == null) {
    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER", 
                                BUNDLE, service.getName()));
  }
  dataReader.setAttachments(message.getAttachments());
  dataReader.setProperty(DataReader.ENDPOINT, message.getExchange().getEndpoint());
  dataReader.setProperty(Message.class.getName(), message);
  setDataReaderValidation(service, message, dataReader);
  return dataReader;
}

origin: org.apache.cxf/cxf-bundle-jaxrs

protected <T> DataReader<T> getDataReader(Message message, Class<T> input) {
  Service service = ServiceModelUtil.getService(message.getExchange());
  DataReader<T> dataReader = service.getDataBinding().createReader(input);
  if (dataReader == null) {
    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAREADER", 
                                BUNDLE, service.getName()));
  }
  dataReader.setAttachments(message.getAttachments());
  dataReader.setProperty(DataReader.ENDPOINT, message.getExchange().getEndpoint());
  dataReader.setProperty(Message.class.getName(), message);
  setDataReaderValidation(service, message, dataReader);
  return dataReader;
}

origin: org.apache.cxf/cxf-rt-bindings-soap

protected DataWriter<XMLStreamWriter> getDataWriter(Message message) {
  Service service = ServiceModelUtil.getService(message.getExchange());
  DataWriter<XMLStreamWriter> dataWriter = service.getDataBinding().createWriter(XMLStreamWriter.class);
  if (dataWriter == null) {
    throw new Fault(new org.apache.cxf.common.i18n.Message("NO_DATAWRITER", BUNDLE, service
      .getName()));
  }
  dataWriter.setAttachments(message.getAttachments());
  setDataWriterValidation(service, message, dataWriter);
  return dataWriter;
}
private void setDataWriterValidation(Service service, Message message, DataWriter<?> writer) {
org.apache.cxf.messageMessagegetAttachments

Javadoc

Retrieve any binary attachments associated with the message.

Popular methods of Message

  • get
  • getExchange
  • put
  • getContent
    Retrieve the encapsulated content as a particular type. The content is available as a result type if
  • setContent
    Provide the encapsulated content as a particular type (a result type if message is outbound, a sourc
  • getInterceptorChain
    Returns a live copy of the messages interceptor chain. This is useful when an interceptor wants to m
  • getContextualProperty
    Queries the Message object's metadata for a specific property.
  • setExchange
  • containsKey
  • remove
  • setInterceptorChain
  • removeContent
    Removes a content from a message. If some contents are completely consumed, removing them is a good
  • setInterceptorChain,
  • removeContent,
  • setAttachments,
  • getDestination,
  • putAll,
  • entrySet,
  • getContentFormats,
  • setContextualProperty,
  • getId

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now