use of javax.mail.util.ByteArrayDataSource in project cxf by apache.
the class SAAJInInterceptorTest method prepareSoapMessage.
private void prepareSoapMessage(String message) throws IOException {
soapMessage = TestUtil.createEmptySoapMessage(Soap12.getInstance(), chain);
ByteArrayDataSource bads = new ByteArrayDataSource(this.getClass().getResourceAsStream(message), "text/xml");
soapMessage.setContent(InputStream.class, bads.getInputStream());
}
use of javax.mail.util.ByteArrayDataSource in project cxf by apache.
the class DataSourceProviderTest method readAttachmentParts.
public static MimeMultipart readAttachmentParts(String contentType, InputStream bais) throws MessagingException, IOException {
DataSource source = new ByteArrayDataSource(bais, contentType);
MimeMultipart mpart = new MimeMultipart(source);
Session session = Session.getDefaultInstance(new Properties());
MimeMessage mm = new MimeMessage(session);
mm.setContent(mpart);
mm.addHeaderLine("Content-Type:" + contentType);
return (MimeMultipart) mm.getContent();
}
use of javax.mail.util.ByteArrayDataSource in project cxf by apache.
the class SwANoMimeServiceImpl method echoDataRef.
public void echoDataRef(Holder<DataStruct> data) {
try {
InputStream bis = null;
bis = data.value.getDataRef().getDataSource().getInputStream();
byte[] b = new byte[6];
bis.read(b, 0, 6);
String string = IOUtils.newStringFromBytes(b);
ByteArrayDataSource source = new ByteArrayDataSource(("test" + string).getBytes(), "application/octet-stream");
data.value.setDataRef(new DataHandler(source));
} catch (IOException e) {
e.printStackTrace();
}
}
use of javax.mail.util.ByteArrayDataSource in project cxf by apache.
the class SwAServiceImpl method echoDataRef.
public void echoDataRef(Holder<DataStruct> data) {
try {
InputStream bis = null;
bis = data.value.getDataRef().getDataSource().getInputStream();
byte[] b = new byte[6];
bis.read(b, 0, 6);
String string = IOUtils.newStringFromBytes(b);
ByteArrayDataSource source = new ByteArrayDataSource(("test" + string).getBytes(), "application/octet-stream");
data.value.setDataRef(new DataHandler(source));
} catch (IOException e) {
e.printStackTrace();
}
}
use of javax.mail.util.ByteArrayDataSource in project cxf by apache.
the class SwAServiceImpl method echoData.
public void echoData(Holder<String> text, Holder<DataHandler> data) {
try {
InputStream bis = null;
bis = data.value.getDataSource().getInputStream();
byte[] b = new byte[6];
bis.read(b, 0, 6);
String string = IOUtils.newStringFromBytes(b);
ByteArrayDataSource source = new ByteArrayDataSource(("test" + string).getBytes(), "application/octet-stream");
data.value = new DataHandler(source);
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations