use of com.sun.xml.ws.encoding.xml.XMLMessage.MessageDataSource in project metro-jax-ws by eclipse-ee4j.
the class XMLHTTPBindingCodec method getStaticContentType.
@Override
public ContentType getStaticContentType(Packet packet) {
ContentType ct;
if (packet.getInternalMessage() instanceof MessageDataSource) {
final MessageDataSource mds = (MessageDataSource) packet.getInternalMessage();
if (mds.hasUnconsumedDataSource()) {
ct = getStaticContentType(mds);
return (ct != null) ? // _adaptingContentType.set(packet, ct)
setAcceptHeader(packet, ct) : null;
}
}
ct = super.getStaticContentType(packet);
return (ct != null) ? // _adaptingContentType.set(packet, ct)
setAcceptHeader(packet, ct) : null;
}
use of com.sun.xml.ws.encoding.xml.XMLMessage.MessageDataSource in project metro-jax-ws by eclipse-ee4j.
the class XMLHTTPBindingCodec method encode.
private ContentType encode(MessageDataSource mds, OutputStream out) {
try {
final boolean isFastInfoset = XMLMessage.isFastInfoset(mds.getDataSource().getContentType());
DataSource ds = transformDataSource(mds.getDataSource(), isFastInfoset, useFastInfosetForEncoding, features);
InputStream is = ds.getInputStream();
byte[] buf = new byte[1024];
int count;
while ((count = is.read(buf)) != -1) {
out.write(buf, 0, count);
}
return new ContentTypeImpl(ds.getContentType());
} catch (IOException ioe) {
throw new WebServiceException(ioe);
}
}
Aggregations