本文整理汇总了Java中com.sun.xml.internal.ws.streaming.MtomStreamWriter类的典型用法代码示例。如果您正苦于以下问题:Java MtomStreamWriter类的具体用法?Java MtomStreamWriter怎么用?Java MtomStreamWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MtomStreamWriter类属于com.sun.xml.internal.ws.streaming包,在下文中一共展示了MtomStreamWriter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writePayloadTo
import com.sun.xml.internal.ws.streaming.MtomStreamWriter; //导入依赖的package包/类
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
try {
// MtomCodec sets its own AttachmentMarshaller
AttachmentMarshaller am = (sw instanceof MtomStreamWriter)
? ((MtomStreamWriter)sw).getAttachmentMarshaller()
: new AttachmentMarshallerImpl(attachmentSet);
// Get output stream and use JAXB UTF-8 writer
OutputStream os = XMLStreamWriterUtil.getOutputStream(sw);
if (os != null) {
bridge.marshal(jaxbObject, os, sw.getNamespaceContext(),am);
} else {
bridge.marshal(jaxbObject,sw,am);
}
//cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
//am.cleanup();
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}
示例2: writePayloadTo
import com.sun.xml.internal.ws.streaming.MtomStreamWriter; //导入依赖的package包/类
@Override
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
try {
// MtomCodec sets its own AttachmentMarshaller
AttachmentMarshaller am = (sw instanceof MtomStreamWriter)
? ((MtomStreamWriter)sw).getAttachmentMarshaller()
: new AttachmentMarshallerImpl(attachmentSet);
// Get the encoding of the writer
String encoding = XMLStreamWriterUtil.getEncoding(sw);
// Get output stream and use JAXB UTF-8 writer
OutputStream os = bridge.supportOutputStream() ? XMLStreamWriterUtil.getOutputStream(sw) : null;
if (rawContext != null) {
Marshaller m = rawContext.createMarshaller();
m.setProperty("jaxb.fragment", Boolean.TRUE);
m.setAttachmentMarshaller(am);
if (os != null) {
m.marshal(jaxbObject, os);
} else {
m.marshal(jaxbObject, sw);
}
} else {
if (os != null && encoding != null && encoding.equalsIgnoreCase(SOAPBindingCodec.UTF8_ENCODING)) {
bridge.marshal(jaxbObject, os, sw.getNamespaceContext(), am);
} else {
bridge.marshal(jaxbObject, sw, am);
}
}
//cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
//am.cleanup();
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}
示例3: writeTo
import com.sun.xml.internal.ws.streaming.MtomStreamWriter; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void writeTo(XMLStreamWriter sw) throws XMLStreamException {
try {
// MtomCodec sets its own AttachmentMarshaller
AttachmentMarshaller am = (sw instanceof MtomStreamWriter)
? ((MtomStreamWriter) sw).getAttachmentMarshaller()
: new AttachmentMarshallerImpl(attachmentSet);
// Get the encoding of the writer
String encoding = XMLStreamWriterUtil.getEncoding(sw);
// Get output stream and use JAXB UTF-8 writer
OutputStream os = bridge.supportOutputStream() ? XMLStreamWriterUtil.getOutputStream(sw) : null;
if (rawContext != null) {
Marshaller m = rawContext.createMarshaller();
m.setProperty("jaxb.fragment", Boolean.FALSE);
m.setAttachmentMarshaller(am);
if (os != null) {
m.marshal(jaxbObject, os);
} else {
m.marshal(jaxbObject, sw);
}
} else {
if (os != null && encoding != null && encoding.equalsIgnoreCase(SOAPBindingCodec.UTF8_ENCODING)) {
bridge.marshal(jaxbObject, os, sw.getNamespaceContext(), am);
} else {
bridge.marshal(jaxbObject, sw, am);
}
}
//cleanup() is not needed since JAXB doesn't keep ref to AttachmentMarshaller
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}