com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource Java Examples

The following examples show how to use com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource. 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: EnvelopeFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static Envelope createEnvelope(Source src, SOAPPartImpl soapPart)
    throws SOAPException
{
        if (src instanceof JAXMStreamSource) {
            try {
                if (!SOAPPartImpl.lazyContentLength) {
                    ((JAXMStreamSource) src).reset();
                }
            } catch (java.io.IOException ioe) {
                log.severe("SAAJ0515.source.reset.exception");
                throw new SOAPExceptionImpl(ioe);
            }
        }
    if (src instanceof LazyEnvelopeSource) {
      return lazy((LazyEnvelopeSource)src, soapPart);
  }
    if (soapPart.message.isLazySoapBodyParsing()) {
        return parseEnvelopeStax(src, soapPart);
    } else {
        return parseEnvelopeSax(src, soapPart);
    }
}
 
Example #2
Source File: SOAPPartImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Source getContent() throws SOAPException {
    if (source != null) {
        InputStream bis = null;
        if (source instanceof JAXMStreamSource) {
            StreamSource streamSource = (StreamSource)source;
            bis = streamSource.getInputStream();
        } else if (FastInfosetReflection.isFastInfosetSource(source)) {
            // FastInfosetSource inherits from SAXSource
            SAXSource saxSource = (SAXSource)source;
            bis = saxSource.getInputSource().getByteStream();
        }

        if (bis != null) {
            try {
                bis.reset();
            } catch (IOException e) {
                /* This exception will never be thrown.
                 *
                 * The setContent method will modify the source
                 * if StreamSource to JAXMStreamSource, that uses
                 * a ByteInputStream, and for a FastInfosetSource will
                 * replace the InputStream with a ByteInputStream.
                 */
            }
        }
        return source;
    }

    return ((Envelope) getEnvelope()).getContent();
}