• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Attachment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.ws.api.message.Attachment的典型用法代码示例。如果您正苦于以下问题:Java Attachment类的具体用法?Java Attachment怎么用?Java Attachment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Attachment类属于com.sun.xml.internal.ws.api.message包,在下文中一共展示了Attachment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: get

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Nullable
public Attachment get(String contentId) {
    Attachment att;
    /**
     * First try to get the Attachment from internal map, maybe this attachment
     * is added by the user.
     */
    att = atts.get(contentId);
    if(att != null)
        return att;
    try {
        /**
         * Attachment is not found in the internal map, now do look in
         * the mpp, if found add to the internal Attachment map.
         */
        att = mpp.getAttachmentPart(contentId);
        if(att != null){
            atts.put(contentId, att);
        }
    } catch (IOException e) {
        throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(contentId), e);
    }
    return att;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:MimeAttachmentSet.java


示例2: callHandlersOnResponse

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) {
    //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
    Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
    AttachmentSet attSet = context.packet.getMessage().getAttachments();
    for (Entry<String, DataHandler> entry : atts.entrySet()) {
        String cid = entry.getKey();
        if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice
            Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
            attSet.add(att);
        }
    }

    try {
        //SERVER-SIDE
        processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault);

    } catch (WebServiceException wse) {
        //no rewrapping
        throw wse;
    } catch (RuntimeException re) {
        throw re;

    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ServerMessageHandlerTube.java


示例3: callHandlersOnResponse

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) {

        //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
        Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
        AttachmentSet attSet = context.packet.getMessage().getAttachments();
        for (Map.Entry<String, DataHandler> entry : atts.entrySet()) {
            String cid = entry.getKey();
            if (attSet.get(cid) == null) { // Otherwise we would be adding attachments twice
                Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
                attSet.add(att);
            }
        }

        try {
            //SERVER-SIDE
            processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault);

        } catch (WebServiceException wse) {
            //no rewrapping
            throw wse;
        } catch (RuntimeException re) {
            throw re;

        }
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:ServerSOAPHandlerTube.java


示例4: callHandlersOnResponse

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
void callHandlersOnResponse(MessageUpdatableContext context, boolean handleFault) {
    //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
    Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
    AttachmentSet attSet = context.packet.getMessage().getAttachments();
    for (Entry<String, DataHandler> entry : atts.entrySet()) {
        String cid = entry.getKey();
        Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
        attSet.add(att);
    }

    try {
        //SERVER-SIDE
        processor.callHandlersResponse(HandlerProcessor.Direction.OUTBOUND, context, handleFault);

    } catch (WebServiceException wse) {
        //no rewrapping
        throw wse;
    } catch (RuntimeException re) {
        throw re;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ServerLogicalHandlerTube.java


示例5: readRequest

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
public void readRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    boolean foundAttachment = false;
    // TODO not to loop
    for (Attachment att : msg.getAttachments()) {
        String part = getWSDLPartName(att);
        if (part == null) {
            continue;
        }
        if(part.equals(pname) || part.equals(pname1)){
            foundAttachment = true;
            mapAttachment(att, args);
            break;
        }
    }
    if (!foundAttachment) {
        throw new WebServiceException("Missing Attachment for "+pname);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:EndpointArgumentsBuilder.java


示例6: get

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Override
@SuppressWarnings("element-type-mismatch")
public Object get(Object key) {
    if (packet.supports(key)) {
        return packet.get(key);    // strongly typed
    }
    if (packet.getHandlerScopePropertyNames(true).contains(key)) {
        return null;            // no such application-scope property
    }
    Object value =  packet.invocationProperties.get(key);

    //add the attachments from the Message to the corresponding attachment property
    if(key.equals(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS) ||
            key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)){
        Map<String, DataHandler> atts = (Map<String, DataHandler>) value;
        if(atts == null)
            atts = new HashMap<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            atts.put(att.getContentId(), att.asDataHandler());
        }
        return atts;
    }
    return value;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:EndpointMessageContextImpl.java


示例7: writeNonMtomAttachments

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@SuppressWarnings("resource")
private void writeNonMtomAttachments(AttachmentSet attachments,
        OutputStream out, String boundary) throws IOException {

    for (Attachment att : attachments) {

        DataHandler dh = att.asDataHandler();
        if (dh instanceof StreamingDataHandler) {
            StreamingDataHandler sdh = (StreamingDataHandler) dh;
            // If DataHandler has href Content-ID, it is MTOM, so skip.
            if (sdh.getHrefCid() != null)
                continue;
        }

        // build attachment frame
        writeln("--" + boundary, out);
        writeMimeHeaders(att.getContentType(), att.getContentId(), out);
        att.writeTo(out);
        writeln(out); // write \r\n
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:MtomCodec.java


示例8: getAttachmentParts

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
/**
 * Parses the entire stream and returns all MIME parts except root MIME part.
 *
 * @return Map<String, StreamAttachment> for all attachment parts
 */
public @NotNull Map<String, Attachment> getAttachmentParts() {
    if (!gotAll) {
        MIMEPart rootPart = (start != null) ? message.getPart(start) : message.getPart(0);
        List<MIMEPart> parts = message.getAttachments();
        for(MIMEPart part : parts) {
            if (part != rootPart) {
                String cid = part.getContentId();
                if (!attachments.containsKey(cid)) {
                    PartAttachment attach = new PartAttachment(part);
                    attachments.put(attach.getContentId(), attach);
                }
            }
        }
        gotAll = true;
    }
    return attachments;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:MimeMultipartParser.java


示例9: get

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
public Object get(Object key) {
    if(packet.supports(key))
        return packet.get(key);    // strongly typed

    if(packet.getHandlerScopePropertyNames(true).contains(key))
        return null;            // no such application-scope property

    Object value =  packet.invocationProperties.get(key);

    //add the attachments from the Message to the corresponding attachment property
    if(key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)){
        Map<String, DataHandler> atts = (Map<String, DataHandler>) value;
        if(atts == null)
            atts = new HashMap<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            atts.put(att.getContentId(), att.asDataHandler());
        }
        return atts;
    }
    return value;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:ResponseContext.java


示例10: get

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
public Attachment get(String contentId) {
    for( int i=attList.size()-1; i>=0; i-- ) {
        Attachment a = attList.get(i);
        if(a.getContentId().equals(contentId))
            return a;
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:AttachmentSetImpl.java


示例11: addSwaRefAttachment

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Override
public String addSwaRefAttachment(DataHandler data) {
    String cid = encodeCid(null);
    Attachment att = new DataHandlerAttachment(cid, data);
    attachments.add(att);
    cid = "cid:" + cid;
    return cid;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:AttachmentMarshallerImpl.java


示例12: getAttachmentAsDataHandler

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Override
public DataHandler getAttachmentAsDataHandler(String cid) {
    Attachment a = attachments.get(stripScheme(cid));
    if(a==null)
        throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(cid));
    return a.asDataHandler();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:AttachmentUnmarshallerImpl.java


示例13: getAttachmentAsByteArray

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Override
public byte[] getAttachmentAsByteArray(String cid) {
    Attachment a = attachments.get(stripScheme(cid));
    if(a==null)
        throw new WebServiceException(EncodingMessages.NO_SUCH_CONTENT_ID(cid));
    return a.asByteArray();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:AttachmentUnmarshallerImpl.java


示例14: iterator

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
/**
 * Expensive operation.
 */
public Iterator<Attachment> iterator() {
    /**
     * Browse thru all the attachments in the mpp, add them to #atts,
     * then return whether its empty.
     */
    Map<String, Attachment> attachments = mpp.getAttachmentParts();
    for(Map.Entry<String, Attachment> att : attachments.entrySet()) {
        if(atts.get(att.getKey()) == null){
            atts.put(att.getKey(), att.getValue());
        }
    }

    return atts.values().iterator();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:MimeAttachmentSet.java


示例15: addAttachmentsToSOAPMessage

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的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


示例16: callHandlersOnRequest

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
boolean callHandlersOnRequest(MessageUpdatableContext context, boolean isOneWay) {
    boolean handlerResult;

    //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
    Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
    AttachmentSet attSet = context.packet.getMessage().getAttachments();
    for (Entry<String, DataHandler> entry : atts.entrySet()) {
        String cid = entry.getKey();
        if (attSet.get(cid) == null) {  // Otherwise we would be adding attachments twice
            Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
            attSet.add(att);
        }
    }

    try {
        //CLIENT-SIDE
        handlerResult = processor.callHandlersRequest(HandlerProcessor.Direction.OUTBOUND, context, !isOneWay);
    } catch (WebServiceException wse) {
        remedyActionTaken = true;
        //no rewrapping
        throw wse;
    } catch (RuntimeException re) {
        remedyActionTaken = true;

        throw new WebServiceException(re);

    }
    if (!handlerResult) {
        remedyActionTaken = true;
    }
    return handlerResult;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:ClientMessageHandlerTube.java


示例17: get

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
public Object get(Object key) {
    if(key == null)
        return null;
    Object value = asMapIncludingInvocationProperties.get(key);
    //add the attachments from the Message to the corresponding attachment property
    if(key.equals(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS) ||
        key.equals(MessageContext.INBOUND_MESSAGE_ATTACHMENTS)){
        Map<String, DataHandler> atts = (Map<String, DataHandler>) value;
        if(atts == null)
            atts = new HashMap<String, DataHandler>();
        AttachmentSet attSet = packet.getMessage().getAttachments();
        for(Attachment att : attSet){
            String cid = att.getContentId();
            if (cid.indexOf("@jaxws.sun.com") == -1) {
                Object a = atts.get(cid);
                if (a == null) {
                    a = atts.get("<" + cid + ">");
                    if (a == null) atts.put(att.getContentId(), att.asDataHandler());
                }
            } else {
                atts.put(att.getContentId(), att.asDataHandler());
            }
        }
        return atts;
    }
    return value;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:MessageContextImpl.java


示例18: callHandlersOnRequest

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
boolean callHandlersOnRequest(MessageUpdatableContext context, boolean isOneWay) {

        boolean handlerResult;
        //Lets copy all the MessageContext.OUTBOUND_ATTACHMENT_PROPERTY to the message
        Map<String, DataHandler> atts = (Map<String, DataHandler>) context.get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
        AttachmentSet attSet = context.packet.getMessage().getAttachments();
        for (Entry<String, DataHandler> entry : atts.entrySet()) {
            String cid = entry.getKey();
            if (attSet.get(cid) == null) {  // Otherwise we would be adding attachments twice
                Attachment att = new DataHandlerAttachment(cid, atts.get(cid));
                attSet.add(att);
            }
        }

        try {
            //CLIENT-SIDE
            handlerResult = processor.callHandlersRequest(HandlerProcessor.Direction.OUTBOUND, context, !isOneWay);
        } catch (WebServiceException wse) {
            remedyActionTaken = true;
            //no rewrapping
            throw wse;
        } catch (RuntimeException re) {
            remedyActionTaken = true;

            throw new WebServiceException(re);

        }
        if (!handlerResult) {
            remedyActionTaken = true;
        }
        return handlerResult;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:ClientSOAPHandlerTube.java


示例19: readResponse

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Override
public Object readResponse(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    // TODO not to loop
    for (Attachment att : msg.getAttachments()) {
        String part = getWSDLPartName(att);
        if (part == null) {
            continue;
        }
        if(part.equals(pname) || part.equals(pname1)){
            return mapAttachment(att, args);
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:ResponseBuilder.java


示例20: mapAttachment

import com.sun.xml.internal.ws.api.message.Attachment; //导入依赖的package包/类
@Override
Object mapAttachment(Attachment att, Object[] args) {
    att.getContentType();
    StringDataContentHandler sdh = new StringDataContentHandler();
    try {
        String str = (String)sdh.getContent(new DataHandlerDataSource(att.asDataHandler()));
        return setter.put(str, args);
    } catch(Exception e) {
        throw new WebServiceException(e);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ResponseBuilder.java



注:本文中的com.sun.xml.internal.ws.api.message.Attachment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java R类代码示例发布时间:2022-05-23
下一篇:
Java EntityReferenceAction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap