com.sun.xml.internal.stream.buffer.XMLStreamBuffer Java Examples

The following examples show how to use com.sun.xml.internal.stream.buffer.XMLStreamBuffer. 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: SDDocumentSource.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a {@link SDDocumentSource} from {@link XMLStreamBuffer}.
 */
public static SDDocumentSource create(final URL systemId, final XMLStreamBuffer xsb) {
    return new SDDocumentSource() {
        public XMLStreamReader read(XMLInputFactory xif) throws XMLStreamException {
            return xsb.readAsXMLStreamReader();
        }

        public XMLStreamReader read() throws XMLStreamException {
            return xsb.readAsXMLStreamReader();
        }

        public URL getSystemId() {
            return systemId;
        }
    };
}
 
Example #2
Source File: SDDocumentSource.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a {@link SDDocumentSource} from {@link XMLStreamBuffer}.
 */
public static SDDocumentSource create(final URL systemId, final XMLStreamBuffer xsb) {
    return new SDDocumentSource() {
        public XMLStreamReader read(XMLInputFactory xif) throws XMLStreamException {
            return xsb.readAsXMLStreamReader();
        }

        public XMLStreamReader read() throws XMLStreamException {
            return xsb.readAsXMLStreamReader();
        }

        public URL getSystemId() {
            return systemId;
        }
    };
}
 
Example #3
Source File: SDDocumentSource.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates a {@link SDDocumentSource} from {@link XMLStreamBuffer}.
 * @param systemId
 * @param xsb
 * @return
 */
public static SDDocumentSource create(final URL systemId, final XMLStreamBuffer xsb) {
    return new SDDocumentSource() {
        @Override
        public XMLStreamReader read(XMLInputFactory xif) throws XMLStreamException {
            return xsb.readAsXMLStreamReader();
        }

        @Override
        public XMLStreamReader read() throws XMLStreamException {
            return xsb.readAsXMLStreamReader();
        }

        @Override
        public URL getSystemId() {
            return systemId;
        }
    };
}
 
Example #4
Source File: WSEndpointReference.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static XMLStreamBuffer createBufferFromAddress(String address, AddressingVersion version) {
    try {
        MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
        StreamWriterBufferCreator w = new StreamWriterBufferCreator(xsb);
        w.writeStartDocument();
        w.writeStartElement(version.getPrefix(),
            "EndpointReference", version.nsUri);
        w.writeNamespace(version.getPrefix(), version.nsUri);
        w.writeStartElement(version.getPrefix(),version.eprType.address, version.nsUri);
        w.writeCharacters(address);
        w.writeEndElement();
        w.writeEndElement();
        w.writeEndDocument();
        w.close();
        return xsb;
    } catch (XMLStreamException e) {
        // can never happen because we are writing to XSB
        throw new AssertionError(e);
    }
}
 
Example #5
Source File: WSEndpointReference.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link WSEndpointReference} that wraps a given infoset.
 */
public WSEndpointReference(XMLStreamBuffer infoset, AddressingVersion version) {
    try {
        this.infoset = infoset;
        this.version = version;
        this.rootElement = new QName("EndpointReference", version.nsUri);
        parse();
    } catch (XMLStreamException e) {
        // this can never happen because XMLStreamBuffer never has underlying I/O error.
        throw new AssertionError(e);
    }
}
 
Example #6
Source File: StreamReaderBufferProcessor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void setXMLStreamBuffer(XMLStreamBuffer buffer) throws XMLStreamException {
    setBuffer(buffer,buffer.isFragment());

    _completionState = PARSING;
    _namespaceAIIsEnd = 0;
    _characters = null;
    _charSequence = null;
    _eventType = START_DOCUMENT;
}
 
Example #7
Source File: StreamMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static XMLStreamBuffer cacheHeaders(XMLStreamReader reader,
        Map<String, String> namespaces, HeaderList headers,
        StreamHeaderDecoder headerDecoder) throws XMLStreamException {
    MutableXMLStreamBuffer buffer = createXMLStreamBuffer();
    StreamReaderBufferCreator creator = new StreamReaderBufferCreator();
    creator.setXMLStreamBuffer(buffer);

    // Reader is positioned at the first header block
    while(reader.getEventType() == javax.xml.stream.XMLStreamConstants.START_ELEMENT) {
        Map<String,String> headerBlockNamespaces = namespaces;

        // Collect namespaces on SOAP header block
        if (reader.getNamespaceCount() > 0) {
            headerBlockNamespaces = new HashMap<String,String>(namespaces);
            for (int i = 0; i < reader.getNamespaceCount(); i++) {
                headerBlockNamespaces.put(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
            }
        }

        // Mark
        XMLStreamBuffer mark = new XMLStreamBufferMark(headerBlockNamespaces, creator);
        // Create Header
        headers.add(headerDecoder.decodeHeader(reader, mark));


        // Cache the header block
        // After caching Reader will be positioned at next header block or
        // the end of the </soap:header>
        creator.createElementFragment(reader, false);
        if (reader.getEventType() != XMLStreamConstants.START_ELEMENT &&
                reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
            XMLStreamReaderUtil.nextElementContent(reader);
        }
    }

    return buffer;
}
 
Example #8
Source File: Stub.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #9
Source File: StreamReaderBufferProcessor.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void setXMLStreamBuffer(XMLStreamBuffer buffer) throws XMLStreamException {
    setBuffer(buffer,buffer.isFragment());

    _completionState = PARSING;
    _namespaceAIIsEnd = 0;
    _characters = null;
    _charSequence = null;
    _eventType = START_DOCUMENT;
}
 
Example #10
Source File: Stub.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #11
Source File: Stub.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #12
Source File: StreamWriterBufferProcessor.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public final void process(XMLStreamBuffer buffer, XMLStreamWriter writer) throws XMLStreamException {
    setXMLStreamBuffer(buffer,buffer.isFragment());
    process(writer);
}
 
Example #13
Source File: StreamReaderBufferProcessor.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public StreamReaderBufferProcessor(XMLStreamBuffer buffer) throws XMLStreamException {
    this();
    setXMLStreamBuffer(buffer);
}
 
Example #14
Source File: StreamHeader12.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public StreamHeader12(XMLStreamReader reader, XMLStreamBuffer mark) {
    super(reader, mark);
}
 
Example #15
Source File: StreamMessage.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Header decodeHeader(XMLStreamReader reader, XMLStreamBuffer mark) {
    return new StreamHeader11(reader, mark);
}
 
Example #16
Source File: StreamHeader11.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public StreamHeader11(XMLStreamReader reader, XMLStreamBuffer mark) {
    super(reader, mark);
}
 
Example #17
Source File: StreamReaderBufferProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public StreamReaderBufferProcessor(XMLStreamBuffer buffer) throws XMLStreamException {
    this();
    setXMLStreamBuffer(buffer);
}
 
Example #18
Source File: WSEndpointReference.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private boolean isInscope(XMLStreamBuffer buffer, int depth) {
    return buffer.getInscopeNamespaces().size() > 0 && depth ==0;
}
 
Example #19
Source File: StreamWriterBufferProcessor.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public final void process(XMLStreamBuffer buffer, XMLStreamWriter writer) throws XMLStreamException {
    setXMLStreamBuffer(buffer,buffer.isFragment());
    process(writer);
}
 
Example #20
Source File: OutboundReferenceParameterHeader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
OutboundReferenceParameterHeader(XMLStreamBuffer infoset, String nsUri, String localName) {
    this.infoset = infoset;
    this.nsUri = nsUri;
    this.localName = localName;
}
 
Example #21
Source File: StreamHeader11.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public StreamHeader11(XMLStreamReader reader, XMLStreamBuffer mark) {
    super(reader, mark);
}
 
Example #22
Source File: StreamHeader12.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public StreamHeader12(XMLStreamReader reader, XMLStreamBuffer mark) {
    super(reader, mark);
}
 
Example #23
Source File: WSEPRExtension.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public WSEPRExtension(XMLStreamBuffer xsb, QName qname) {
    this.xsb = xsb;
    this.qname = qname;
}
 
Example #24
Source File: StreamWriterBufferProcessor.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public final void process(XMLStreamBuffer buffer, XMLStreamWriter writer) throws XMLStreamException {
    setXMLStreamBuffer(buffer,buffer.isFragment());
    process(writer);
}
 
Example #25
Source File: FastInfosetStreamSOAP11Codec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected final StreamHeader createHeader(XMLStreamReader reader, XMLStreamBuffer mark) {
    return new StreamHeader11(reader, mark);
}
 
Example #26
Source File: StreamMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Header decodeHeader(XMLStreamReader reader, XMLStreamBuffer mark) {
    return new StreamHeader11(reader, mark);
}
 
Example #27
Source File: FastInfosetStreamSOAP11Codec.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected final StreamHeader createHeader(XMLStreamReader reader, XMLStreamBuffer mark) {
    return new StreamHeader11(reader, mark);
}
 
Example #28
Source File: StreamWriterBufferProcessor.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public final void process(XMLStreamBuffer buffer, XMLStreamWriter writer) throws XMLStreamException {
    setXMLStreamBuffer(buffer,buffer.isFragment());
    process(writer);
}
 
Example #29
Source File: StreamMessage.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Header decodeHeader(XMLStreamReader reader, XMLStreamBuffer mark) {
    return new StreamHeader11(reader, mark);
}
 
Example #30
Source File: FastInfosetStreamSOAP11Codec.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected final StreamHeader createHeader(XMLStreamReader reader, XMLStreamBuffer mark) {
    return new StreamHeader11(reader, mark);
}