com.sun.xml.internal.ws.api.message.AttachmentSet Java Examples
The following examples show how to use
com.sun.xml.internal.ws.api.message.AttachmentSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerMessageHandlerTube.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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; } }
Example #2
Source File: ResponseContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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; }
Example #3
Source File: EndpointMessageContextImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@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; }
Example #4
Source File: EndpointArgumentsBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void readRequest( Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException { Object obj = null; AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null; if (bridge instanceof RepeatedElementBridge) { RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge; ArrayList list = new ArrayList(); QName name = r.getName(); while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) { list.add(rbridge.unmarshal(r, au)); XMLStreamReaderUtil.toNextTag(r, name); } obj = rbridge.collectionHandler().convert(list); } else { obj = bridge.unmarshal(r, au); } setter.put(obj,args); }
Example #5
Source File: ResponseContext.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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; }
Example #6
Source File: ServerSOAPHandlerTube.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; } }
Example #7
Source File: ServerSOAPHandlerTube.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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; } }
Example #8
Source File: ResponseBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
final Object readResponse(Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException { Object obj; AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null; if (bridge instanceof RepeatedElementBridge) { RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge; ArrayList list = new ArrayList(); QName name = r.getName(); while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) { list.add(rbridge.unmarshal(r, au)); XMLStreamReaderUtil.toNextTag(r, name); } obj = rbridge.collectionHandler().convert(list); } else { obj = bridge.unmarshal(r, au); } return setter.put(obj,args); }
Example #9
Source File: ResponseBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
final Object readResponse(Object[] args, XMLStreamReader r, AttachmentSet att) throws JAXBException { Object obj; AttachmentUnmarshallerImpl au = (att != null)?new AttachmentUnmarshallerImpl(att):null; if (bridge instanceof RepeatedElementBridge) { RepeatedElementBridge rbridge = (RepeatedElementBridge)bridge; ArrayList list = new ArrayList(); QName name = r.getName(); while (r.getEventType()==XMLStreamReader.START_ELEMENT && name.equals(r.getName())) { list.add(rbridge.unmarshal(r, au)); XMLStreamReaderUtil.toNextTag(r, name); } obj = rbridge.collectionHandler().convert(list); } else { obj = bridge.unmarshal(r, au); } return setter.put(obj,args); }
Example #10
Source File: ResponseContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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; }
Example #11
Source File: ServerMessageHandlerTube.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; } }
Example #12
Source File: ServerLogicalHandlerTube.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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; } }
Example #13
Source File: MtomCodec.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@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 } }
Example #14
Source File: ServerLogicalHandlerTube.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; } }
Example #15
Source File: ServerSOAPHandlerTube.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; } }
Example #16
Source File: ServerLogicalHandlerTube.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; } }
Example #17
Source File: StreamSOAPCodec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void decode(InputStream in, String contentType, Packet packet, AttachmentSet att ) throws IOException { List<String> expectedContentTypes = getExpectedContentTypes(); if (contentType != null && !isContentTypeSupported(contentType,expectedContentTypes)) { throw new UnsupportedMediaException(contentType, expectedContentTypes); } com.oracle.webservices.internal.api.message.ContentType pct = packet.getInternalContentType(); ContentTypeImpl cti = (pct != null && pct instanceof ContentTypeImpl) ? (ContentTypeImpl)pct : new ContentTypeImpl(contentType); String charset = cti.getCharSet(); if (charset != null && !Charset.isSupported(charset)) { throw new UnsupportedMediaException(charset); } if (charset != null) { packet.invocationProperties.put(DECODED_MESSAGE_CHARSET, charset); } else { packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET); } packet.setMessage(streamDecoder.decode(in, charset, att, soapVersion)); }
Example #18
Source File: MtomCodec.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@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 } }
Example #19
Source File: PayloadSourceMessage.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public PayloadSourceMessage(@Nullable MessageHeaders headers, @NotNull Source payload, @NotNull AttachmentSet attSet, @NotNull SOAPVersion soapVersion) { super(headers, SourceReaderFactory.createSourceReader(payload, true), attSet, soapVersion); }
Example #20
Source File: JAXBMessage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private JAXBMessage( JAXBContext rawContext, Object jaxbObject, SOAPVersion soapVer, MessageHeaders headers, AttachmentSet attachments ) { super(soapVer); // this.bridge = new MarshallerBridge(context); this.rawContext = rawContext; this.bridge = null; this.jaxbObject = jaxbObject; this.headers = headers; this.attachmentSet = attachments; }
Example #21
Source File: JAXBMessage.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private JAXBMessage( BindingContext context, Object jaxbObject, SOAPVersion soapVer, MessageHeaders headers, AttachmentSet attachments ) { super(soapVer); // this.bridge = new MarshallerBridge(context); this.bridge = context.createFragmentBridge(); this.rawContext = null; this.jaxbObject = jaxbObject; this.headers = headers; this.attachmentSet = attachments; }
Example #22
Source File: LogicalMessageImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public Message getMessage(MessageHeaders headers, AttachmentSet attachments, WSBinding binding) { Node n = dom.getNode(); if(n.getNodeType()== Node.DOCUMENT_NODE) { n = ((Document)n).getDocumentElement(); } return new DOMMessage(binding.getSOAPVersion(), headers, (Element)n, attachments); }
Example #23
Source File: JAXBMessage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private JAXBMessage( BindingContext context, Object jaxbObject, SOAPVersion soapVer, MessageHeaders headers, AttachmentSet attachments ) { super(soapVer); // this.bridge = new MarshallerBridge(context); this.bridge = context.createFragmentBridge(); this.rawContext = null; this.jaxbObject = jaxbObject; this.headers = headers; this.attachmentSet = attachments; }
Example #24
Source File: LogicalMessageImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * This should be called by first checking if the payload is modified. * * @param headers * @param attachments * @param binding * @return */ public Message getMessage(MessageHeaders headers, AttachmentSet attachments, WSBinding binding) { assert isPayloadModifed(); if(isPayloadModifed()) { return lm.getMessage(headers,attachments,binding); } else { return packet.getMessage(); } }
Example #25
Source File: PayloadSourceMessage.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public PayloadSourceMessage(@Nullable MessageHeaders headers, @NotNull Source payload, @NotNull AttachmentSet attSet, @NotNull SOAPVersion soapVersion) { super(headers, SourceReaderFactory.createSourceReader(payload, true), attSet, soapVersion); }
Example #26
Source File: ClientMessageHandlerTube.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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; }
Example #27
Source File: LogicalMessageImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * This should be called by first checking if the payload is modified. * * @param headers * @param attachments * @param binding * @return */ public Message getMessage(MessageHeaders headers, AttachmentSet attachments, WSBinding binding) { assert isPayloadModifed(); if(isPayloadModifed()) { return lm.getMessage(headers,attachments,binding); } else { return packet.getMessage(); } }
Example #28
Source File: DispatchImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected AttachmentSet setOutboundAttachments() { HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>) getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS); if (attachments != null) { List<Attachment> alist = new ArrayList(); for (Map.Entry<String, DataHandler> att : attachments.entrySet()) { DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue()); alist.add(dha); } return new AttachmentSetImpl(alist); } return new AttachmentSetImpl(); }
Example #29
Source File: StreamMessage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void init(@NotNull TagInfoset envelopeTag, @Nullable TagInfoset headerTag, @NotNull AttachmentSet attachmentSet, @Nullable MessageHeaders headers, @Nullable String bodyPrologue, @NotNull TagInfoset bodyTag, @Nullable String bodyEpilogue, @NotNull XMLStreamReader reader, @NotNull SOAPVersion soapVersion) { init(headers,attachmentSet,reader,soapVersion); if(envelopeTag == null ) { throw new IllegalArgumentException("EnvelopeTag TagInfoset cannot be null"); } if(bodyTag == null ) { throw new IllegalArgumentException("BodyTag TagInfoset cannot be null"); } this.envelopeTag = envelopeTag; this.headerTag = headerTag; this.bodyTag = bodyTag; this.bodyPrologue = bodyPrologue; this.bodyEpilogue = bodyEpilogue; }
Example #30
Source File: PayloadSourceMessage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public PayloadSourceMessage(@Nullable MessageHeaders headers, @NotNull Source payload, @NotNull AttachmentSet attSet, @NotNull SOAPVersion soapVersion) { super(headers, SourceReaderFactory.createSourceReader(payload, true), attSet, soapVersion); }