本文整理汇总了Java中com.sun.xml.internal.ws.api.message.AttachmentEx类的典型用法代码示例。如果您正苦于以下问题:Java AttachmentEx类的具体用法?Java AttachmentEx怎么用?Java AttachmentEx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttachmentEx类属于com.sun.xml.internal.ws.api.message包,在下文中一共展示了AttachmentEx类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addAttachmentsToSOAPMessage
import com.sun.xml.internal.ws.api.message.AttachmentEx; //导入依赖的package包/类
static protected void addAttachmentsToSOAPMessage(SOAPMessage msg, Message message) {
for(Attachment att : message.getAttachments()) {
AttachmentPart part = msg.createAttachmentPart();
part.setDataHandler(att.asDataHandler());
// Be safe and avoid double angle-brackets.
String cid = att.getContentId();
if (cid != null) {
if (cid.startsWith("<") && cid.endsWith(">"))
part.setContentId(cid);
else
part.setContentId('<' + cid + '>');
}
// Add any MIME headers beside Content-ID, which is already
// accounted for above, and Content-Type, which is provided
// by the DataHandler above.
if (att instanceof AttachmentEx) {
AttachmentEx ax = (AttachmentEx) att;
Iterator<AttachmentEx.MimeHeader> imh = ax.getMimeHeaders();
while (imh.hasNext()) {
AttachmentEx.MimeHeader ame = imh.next();
if ((!"Content-ID".equals(ame.getName()))
&& (!"Content-Type".equals(ame.getName())))
part.addMimeHeader(ame.getName(), ame.getValue());
}
}
msg.addAttachmentPart(part);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:SAAJFactory.java
示例2: getMimeHeaders
import com.sun.xml.internal.ws.api.message.AttachmentEx; //导入依赖的package包/类
@Override
public Iterator<MimeHeader> getMimeHeaders() {
final Iterator<? extends Header> ih = part.getAllHeaders()
.iterator();
return new Iterator<MimeHeader>() {
@Override
public boolean hasNext() {
return ih.hasNext();
}
@Override
public MimeHeader next() {
final Header hdr = ih.next();
return new AttachmentEx.MimeHeader() {
@Override
public String getValue() {
return hdr.getValue();
}
@Override
public String getName() {
return hdr.getName();
}
};
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:MimeMultipartParser.java
示例3: writeCustomMimeHeaders
import com.sun.xml.internal.ws.api.message.AttachmentEx; //导入依赖的package包/类
private void writeCustomMimeHeaders(Attachment att, OutputStream out) throws IOException {
if (att instanceof AttachmentEx) {
Iterator<AttachmentEx.MimeHeader> allMimeHeaders = ((AttachmentEx) att).getMimeHeaders();
while (allMimeHeaders.hasNext()) {
AttachmentEx.MimeHeader mh = allMimeHeaders.next();
String name = mh.getName();
if (!"Content-Type".equalsIgnoreCase(name) && !"Content-Id".equalsIgnoreCase(name)) {
writeln(name +": " + mh.getValue(), out);
}
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:MimeCodec.java
注:本文中的com.sun.xml.internal.ws.api.message.AttachmentEx类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论