equal
deleted
inserted
replaced
39 import com.sun.xml.internal.ws.developer.SerializationFeature; |
39 import com.sun.xml.internal.ws.developer.SerializationFeature; |
40 import com.sun.xml.internal.ws.developer.StreamingDataHandler; |
40 import com.sun.xml.internal.ws.developer.StreamingDataHandler; |
41 import com.sun.xml.internal.ws.message.MimeAttachmentSet; |
41 import com.sun.xml.internal.ws.message.MimeAttachmentSet; |
42 import com.sun.xml.internal.ws.streaming.XMLStreamWriterUtil; |
42 import com.sun.xml.internal.ws.streaming.XMLStreamWriterUtil; |
43 import com.sun.xml.internal.ws.util.ByteArrayDataSource; |
43 import com.sun.xml.internal.ws.util.ByteArrayDataSource; |
|
44 import com.sun.xml.internal.ws.util.xml.NamespaceContextExAdaper; |
44 import com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter; |
45 import com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter; |
45 import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter; |
46 import com.sun.xml.internal.ws.util.xml.XMLStreamWriterFilter; |
46 import com.sun.xml.internal.ws.streaming.MtomStreamWriter; |
47 import com.sun.xml.internal.ws.streaming.MtomStreamWriter; |
47 import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; |
48 import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil; |
48 import com.sun.xml.internal.ws.server.UnsupportedMediaException; |
49 import com.sun.xml.internal.ws.server.UnsupportedMediaException; |
372 } |
373 } |
373 |
374 |
374 private void writeBinary(ByteArrayBuffer bab) { |
375 private void writeBinary(ByteArrayBuffer bab) { |
375 try { |
376 try { |
376 mtomAttachments.add(bab); |
377 mtomAttachments.add(bab); |
377 writer.setPrefix("xop", XOP_NAMESPACEURI); |
378 String prefix = writer.getPrefix(XOP_NAMESPACEURI); |
378 writer.writeNamespace("xop", XOP_NAMESPACEURI); |
379 if (prefix == null || !prefix.equals("xop")) { |
|
380 writer.setPrefix("xop", XOP_NAMESPACEURI); |
|
381 writer.writeNamespace("xop", XOP_NAMESPACEURI); |
|
382 } |
379 writer.writeStartElement(XOP_NAMESPACEURI, XOP_LOCALNAME); |
383 writer.writeStartElement(XOP_NAMESPACEURI, XOP_LOCALNAME); |
380 writer.writeAttribute("href", "cid:"+bab.contentId); |
384 writer.writeAttribute("href", "cid:"+bab.contentId); |
381 writer.writeEndElement(); |
385 writer.writeEndElement(); |
382 writer.flush(); |
386 writer.flush(); |
383 } catch (XMLStreamException e) { |
387 } catch (XMLStreamException e) { |
511 return reader.getText(); |
515 return reader.getText(); |
512 } |
516 } |
513 |
517 |
514 @Override |
518 @Override |
515 public NamespaceContextEx getNamespaceContext() { |
519 public NamespaceContextEx getNamespaceContext() { |
516 NamespaceContext nsContext = reader.getNamespaceContext(); |
520 return new NamespaceContextExAdaper(reader.getNamespaceContext()); |
517 return new MtomNamespaceContextEx(nsContext); |
|
518 } |
521 } |
519 |
522 |
520 @Override |
523 @Override |
521 public String getElementTextTrim() throws XMLStreamException { |
524 public String getElementTextTrim() throws XMLStreamException { |
522 throw new UnsupportedOperationException(); |
525 throw new UnsupportedOperationException(); |
523 } |
|
524 |
|
525 private static class MtomNamespaceContextEx implements NamespaceContextEx { |
|
526 private final NamespaceContext nsContext; |
|
527 |
|
528 public MtomNamespaceContextEx(NamespaceContext nsContext) { |
|
529 this.nsContext = nsContext; |
|
530 } |
|
531 |
|
532 @Override |
|
533 public Iterator<Binding> iterator() { |
|
534 throw new UnsupportedOperationException(); |
|
535 } |
|
536 |
|
537 @Override |
|
538 public String getNamespaceURI(String prefix) { |
|
539 return nsContext.getNamespaceURI(prefix); |
|
540 } |
|
541 |
|
542 @Override |
|
543 public String getPrefix(String namespaceURI) { |
|
544 return nsContext.getPrefix(namespaceURI); |
|
545 } |
|
546 |
|
547 @Override |
|
548 public Iterator getPrefixes(String namespaceURI) { |
|
549 return nsContext.getPrefixes(namespaceURI); |
|
550 } |
|
551 |
|
552 } |
526 } |
553 |
527 |
554 @Override |
528 @Override |
555 public int getTextLength() { |
529 public int getTextLength() { |
556 if (xopReferencePresent) { |
530 if (xopReferencePresent) { |