本文整理汇总了Java中com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory.recycle方法的典型用法代码示例。如果您正苦于以下问题:Java XMLStreamWriterFactory.recycle方法的具体用法?Java XMLStreamWriterFactory.recycle怎么用?Java XMLStreamWriterFactory.recycle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory
的用法示例。
在下文中一共展示了XMLStreamWriterFactory.recycle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append(super.toString());
String content;
try {
Message msg = getMessage();
if (msg != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLStreamWriter xmlWriter = XMLStreamWriterFactory.create(baos, "UTF-8");
msg.copy().writeTo(xmlWriter);
xmlWriter.flush();
xmlWriter.close();
baos.flush();
XMLStreamWriterFactory.recycle(xmlWriter);
byte[] bytes = baos.toByteArray();
//message = Messages.create(XMLStreamReaderFactory.create(null, new ByteArrayInputStream(bytes), "UTF-8", true));
content = new String(bytes, "UTF-8");
} else {
content = "<none>";
}
} catch (Throwable t) {
throw new WebServiceException(t);
}
buf.append(" Content: ").append(content);
return buf.toString();
}
示例2: encode
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; //导入方法依赖的package包/类
public ContentType encode(Packet packet, OutputStream out) {
if (packet.getMessage() != null) {
String encoding = getPacketEncoding(packet);
packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
XMLStreamWriter writer = XMLStreamWriterFactory.create(out, encoding);
try {
packet.getMessage().writeTo(writer);
writer.flush();
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
XMLStreamWriterFactory.recycle(writer);
}
return getContentType(packet);
}
示例3: encode
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; //导入方法依赖的package包/类
public ContentType encode(Packet packet, OutputStream out) {
if (packet.getMessage() != null) {
XMLStreamWriter writer = XMLStreamWriterFactory.create(out);
try {
packet.getMessage().writeTo(writer);
writer.flush();
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
XMLStreamWriterFactory.recycle(writer);
}
return getContentType(packet.soapAction);
}
示例4: encode
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; //导入方法依赖的package包/类
public ContentType encode(Packet packet, OutputStream out) throws IOException {
//get the current boundary thaat will be reaturned from this method
ContentType contentType = getContentType(packet);
if(packet.getMessage() != null){
try {
writeln("--"+boundary, out);
writeln("Content-Id: " + rootId, out);
writeln("Content-Type: "+ soapXopContentType, out);
writeln("Content-Transfer-Encoding: binary", out);
writeln(out);
//mtom attachments that need to be written after the root part
List<ByteArrayBuffer> mtomAttachments = new ArrayList<ByteArrayBuffer>();
MtomStreamWriterImpl writer = new MtomStreamWriterImpl(XMLStreamWriterFactory.create(out),out, mtomAttachments);
packet.getMessage().writeTo(writer);
XMLStreamWriterFactory.recycle(writer);
writeln(out);
for(ByteArrayBuffer bos : mtomAttachments){
bos.write(out);
}
//now write out the attachments in the message
writeAttachments(packet.getMessage().getAttachments(),out);
//write out the end boundary
writeAsAscii("--"+boundary, out);
writeAsAscii("--", out);
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
}
//now create the boundary for next encode() call
createConteTypeHeader();
return contentType;
}
示例5: encode
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; //导入方法依赖的package包/类
@Override
public ContentType encode(Packet packet, OutputStream out) throws IOException {
ContentTypeImpl ctImpl = (ContentTypeImpl) this.getStaticContentType(packet);
String boundary = ctImpl.getBoundary();
String rootId = ctImpl.getRootId();
if(packet.getMessage() != null){
try {
String encoding = getPacketEncoding(packet);
packet.invocationProperties.remove(DECODED_MESSAGE_CHARSET);
String actionParameter = getActionParameter(packet, version);
String soapXopContentType = getSOAPXopContentType(encoding, version, actionParameter);
writeln("--"+boundary, out);
writeMimeHeaders(soapXopContentType, rootId, out);
//mtom attachments that need to be written after the root part
List<ByteArrayBuffer> mtomAttachments = new ArrayList<ByteArrayBuffer>();
MtomStreamWriterImpl writer = new MtomStreamWriterImpl(
XMLStreamWriterFactory.create(out, encoding), mtomAttachments, boundary, mtomFeature);
packet.getMessage().writeTo(writer);
XMLStreamWriterFactory.recycle(writer);
writeln(out);
for(ByteArrayBuffer bos : mtomAttachments){
bos.write(out);
}
// now write out the attachments in the message that weren't
// previously written
writeNonMtomAttachments(packet.getMessage().getAttachments(),
out, boundary);
//write out the end boundary
writeAsAscii("--"+boundary, out);
writeAsAscii("--", out);
} catch (XMLStreamException e) {
throw new WebServiceException(e);
}
}
//now create the boundary for next encode() call
// createConteTypeHeader();
return ctImpl;
}
示例6: onRecycled
import com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory; //导入方法依赖的package包/类
public void onRecycled() {
XMLStreamWriterFactory.recycle(writer);
writer = null;
}