com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer Java Examples
The following examples show how to use
com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer.
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: JAXBMessage.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public XMLStreamReader readPayload() throws XMLStreamException { try { if(infoset==null) { if (rawContext != null) { XMLStreamBufferResult sbr = new XMLStreamBufferResult(); Marshaller m = rawContext.createMarshaller(); m.setProperty("jaxb.fragment", Boolean.TRUE); m.marshal(jaxbObject, sbr); infoset = sbr.getXMLStreamBuffer(); } else { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writePayloadTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } } XMLStreamReader reader = infoset.readAsXMLStreamReader(); if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); return reader; } catch (JAXBException e) { // bug 6449684, spec 4.3.4 throw new WebServiceException(e); } }
Example #2
Source File: WSEndpointReference.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
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 #3
Source File: JAXBMessage.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public XMLStreamReader readPayload() throws XMLStreamException { try { if(infoset==null) { if (rawContext != null) { XMLStreamBufferResult sbr = new XMLStreamBufferResult(); Marshaller m = rawContext.createMarshaller(); m.setProperty("jaxb.fragment", Boolean.TRUE); m.marshal(jaxbObject, sbr); infoset = sbr.getXMLStreamBuffer(); } else { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writePayloadTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } } XMLStreamReader reader = infoset.readAsXMLStreamReader(); if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); return reader; } catch (JAXBException e) { // bug 6449684, spec 4.3.4 throw new WebServiceException(e); } }
Example #4
Source File: SAXBufferCreator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException { if (_buffer == null) { createBuffer(); } _buffer.setSystemId(systemId); reader.setContentHandler(this); reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this); try { setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE)); } catch (SAXException e) { } if (systemId != null) { InputSource s = new InputSource(systemId); s.setByteStream(in); reader.parse(s); } else { reader.parse(new InputSource(in)); } return getXMLStreamBuffer(); }
Example #5
Source File: SAXBufferCreator.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException { if (_buffer == null) { createBuffer(); } _buffer.setSystemId(systemId); reader.setContentHandler(this); reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this); try { setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE)); } catch (SAXException e) { } if (systemId != null) { InputSource s = new InputSource(systemId); s.setByteStream(in); reader.parse(s); } else { reader.parse(new InputSource(in)); } return getXMLStreamBuffer(); }
Example #6
Source File: JAXBMessage.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public XMLStreamReader readPayload() throws XMLStreamException { try { if(infoset==null) { if (rawContext != null) { XMLStreamBufferResult sbr = new XMLStreamBufferResult(); Marshaller m = rawContext.createMarshaller(); m.setProperty("jaxb.fragment", Boolean.TRUE); m.marshal(jaxbObject, sbr); infoset = sbr.getXMLStreamBuffer(); } else { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writePayloadTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } } XMLStreamReader reader = infoset.readAsXMLStreamReader(); if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); return reader; } catch (JAXBException e) { // bug 6449684, spec 4.3.4 throw new WebServiceException(e); } }
Example #7
Source File: JAXBMessage.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public XMLStreamReader readPayload() throws XMLStreamException { try { if(infoset==null) { if (rawContext != null) { XMLStreamBufferResult sbr = new XMLStreamBufferResult(); Marshaller m = rawContext.createMarshaller(); m.setProperty("jaxb.fragment", Boolean.TRUE); m.marshal(jaxbObject, sbr); infoset = sbr.getXMLStreamBuffer(); } else { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writePayloadTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } } XMLStreamReader reader = infoset.readAsXMLStreamReader(); if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); return reader; } catch (JAXBException e) { // bug 6449684, spec 4.3.4 throw new WebServiceException(e); } }
Example #8
Source File: WSEndpointReference.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
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 #9
Source File: SAXBufferCreator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException { if (_buffer == null) { createBuffer(); } _buffer.setSystemId(systemId); reader.setContentHandler(this); reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this); try { setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE)); } catch (SAXException e) { } if (systemId != null) { InputSource s = new InputSource(systemId); s.setByteStream(in); reader.parse(s); } else { reader.parse(new InputSource(in)); } return getXMLStreamBuffer(); }
Example #10
Source File: SAXBufferCreator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException { if (_buffer == null) { createBuffer(); } _buffer.setSystemId(systemId); reader.setContentHandler(this); reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this); try { setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE)); } catch (SAXException e) { } if (systemId != null) { InputSource s = new InputSource(systemId); s.setByteStream(in); reader.parse(s); } else { reader.parse(new InputSource(in)); } return getXMLStreamBuffer(); }
Example #11
Source File: SAXBufferCreator.java From hottub with GNU General Public License v2.0 | 6 votes |
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException { if (_buffer == null) { createBuffer(); } _buffer.setSystemId(systemId); reader.setContentHandler(this); reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this); try { setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE)); } catch (SAXException e) { } if (systemId != null) { InputSource s = new InputSource(systemId); s.setByteStream(in); reader.parse(s); } else { reader.parse(new InputSource(in)); } return getXMLStreamBuffer(); }
Example #12
Source File: JAXBMessage.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public XMLStreamReader readPayload() throws XMLStreamException { try { if(infoset==null) { if (rawContext != null) { XMLStreamBufferResult sbr = new XMLStreamBufferResult(); Marshaller m = rawContext.createMarshaller(); m.setProperty("jaxb.fragment", Boolean.TRUE); m.marshal(jaxbObject, sbr); infoset = sbr.getXMLStreamBuffer(); } else { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writePayloadTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } } XMLStreamReader reader = infoset.readAsXMLStreamReader(); if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); return reader; } catch (JAXBException e) { // bug 6449684, spec 4.3.4 throw new WebServiceException(e); } }
Example #13
Source File: JAXBMessage.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public XMLStreamReader readPayload() throws XMLStreamException { try { if(infoset==null) { if (rawContext != null) { XMLStreamBufferResult sbr = new XMLStreamBufferResult(); Marshaller m = rawContext.createMarshaller(); m.setProperty("jaxb.fragment", Boolean.TRUE); m.marshal(jaxbObject, sbr); infoset = sbr.getXMLStreamBuffer(); } else { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writePayloadTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } } XMLStreamReader reader = infoset.readAsXMLStreamReader(); if(reader.getEventType()== START_DOCUMENT) XMLStreamReaderUtil.nextElementContent(reader); return reader; } catch (JAXBException e) { // bug 6449684, spec 4.3.4 throw new WebServiceException(e); } }
Example #14
Source File: WSDLGenResolver.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Updates filename if the suggested filename need to be changed in * xsd:import. If there is already a schema document for the namespace * in the metadata, then it is not generated. * * return null if schema need not be generated * Result the generated schema document */ public Result getSchemaOutput(String namespace, Holder<String> filename) { List<SDDocumentImpl> schemas = nsMapping.get(namespace); if (schemas != null) { if (schemas.size() > 1) { throw new ServerRtException("server.rt.err", "More than one schema for the target namespace "+namespace); } filename.value = schemas.get(0).getURL().toExternalForm(); return null; // Don't generate schema } URL url = createURL(filename.value); MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); xsb.setSystemId(url.toExternalForm()); SDDocumentSource sd = SDDocumentSource.create(url,xsb); newDocs.add(sd); XMLStreamBufferResult r = new XMLStreamBufferResult(xsb); r.setSystemId(filename.value); return r; }
Example #15
Source File: WSEndpointReference.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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 #16
Source File: SAXBufferCreator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public MutableXMLStreamBuffer create(XMLReader reader, InputStream in, String systemId) throws IOException, SAXException { if (_buffer == null) { createBuffer(); } _buffer.setSystemId(systemId); reader.setContentHandler(this); reader.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, this); try { setHasInternedStrings(reader.getFeature(Features.STRING_INTERNING_FEATURE)); } catch (SAXException e) { } if (systemId != null) { InputSource s = new InputSource(systemId); s.setByteStream(in); reader.parse(s); } else { reader.parse(new InputSource(in)); } return getXMLStreamBuffer(); }
Example #17
Source File: WSDLGenResolver.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Updates filename if the suggested filename need to be changed in * xsd:import. If there is already a schema document for the namespace * in the metadata, then it is not generated. * * return null if schema need not be generated * Result the generated schema document */ public Result getSchemaOutput(String namespace, Holder<String> filename) { List<SDDocumentImpl> schemas = nsMapping.get(namespace); if (schemas != null) { if (schemas.size() > 1) { throw new ServerRtException("server.rt.err", "More than one schema for the target namespace "+namespace); } filename.value = schemas.get(0).getURL().toExternalForm(); return null; // Don't generate schema } URL url = createURL(filename.value); MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); xsb.setSystemId(url.toExternalForm()); SDDocumentSource sd = SDDocumentSource.create(url,xsb); newDocs.add(sd); XMLStreamBufferResult r = new XMLStreamBufferResult(xsb); r.setSystemId(filename.value); return r; }
Example #18
Source File: StreamReaderBufferCreator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Creates the buffer from a stream reader that is an element fragment. * <p> * The stream reader will be moved to the position of the next start of * an element if the stream reader is not already positioned at the start * of an element. * <p> * The element and all its children will be stored and after storing the stream * will be positioned at the next event after the end of the element. * <p> * @param storeInScopeNamespaces true if in-scope namespaces of the element * fragment should be stored. * @return the mutable stream buffer. * @throws XMLStreamException if the stream reader cannot be positioned at * the start of an element. */ public MutableXMLStreamBuffer createElementFragment(XMLStreamReader reader, boolean storeInScopeNamespaces) throws XMLStreamException { if (_buffer == null) { createBuffer(); } if (!reader.hasNext()) { return _buffer; } _storeInScopeNamespacesOnElementFragment = storeInScopeNamespaces; _eventType = reader.getEventType(); if (_eventType != XMLStreamReader.START_ELEMENT) { do { _eventType = reader.next(); } while(_eventType != XMLStreamReader.START_ELEMENT && _eventType != XMLStreamReader.END_DOCUMENT); } if (storeInScopeNamespaces) { _inScopePrefixes = new HashMap<String,Integer>(); } storeElementAndChildren(reader); return getXMLStreamBuffer(); }
Example #19
Source File: WSEndpointReference.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates from the spec version of {@link EndpointReference}. * * <p> * This method performs the data conversion, so it's slow. * Do not use this method in a performance critical path. */ public WSEndpointReference(EndpointReference epr, AddressingVersion version) { try { MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); epr.writeTo(new XMLStreamBufferResult(xsb)); this.infoset = xsb; this.version = version; this.rootElement = new QName("EndpointReference", version.nsUri); parse(); } catch (XMLStreamException e) { throw new WebServiceException(ClientMessages.FAILED_TO_PARSE_EPR(epr),e); } }
Example #20
Source File: WSDLGenResolver.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Generates the concrete WSDL that contains service element. * * @return Result the generated concrete WSDL */ public Result getWSDL(String filename) { URL url = createURL(filename); MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); xsb.setSystemId(url.toExternalForm()); concreteWsdlSource = SDDocumentSource.create(url,xsb); newDocs.add(concreteWsdlSource); XMLStreamBufferResult r = new XMLStreamBufferResult(xsb); r.setSystemId(filename); return r; }
Example #21
Source File: StreamMessage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static MutableXMLStreamBuffer createXMLStreamBuffer() { // TODO: Decode should own one MutableXMLStreamBuffer for reuse // since it is more efficient. ISSUE: possible issue with // lifetime of information in the buffer if accessed beyond // the pipe line. return new MutableXMLStreamBuffer(); }
Example #22
Source File: StreamMessage.java From hottub with GNU General Public License v2.0 | 5 votes |
private static MutableXMLStreamBuffer createXMLStreamBuffer() { // TODO: Decode should own one MutableXMLStreamBuffer for reuse // since it is more efficient. ISSUE: possible issue with // lifetime of information in the buffer if accessed beyond // the pipe line. return new MutableXMLStreamBuffer(); }
Example #23
Source File: WSEndpointReference.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Creates from the spec version of {@link EndpointReference}. * * <p> * This method performs the data conversion, so it's slow. * Do not use this method in a performance critical path. */ public WSEndpointReference(EndpointReference epr, AddressingVersion version) { try { MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); epr.writeTo(new XMLStreamBufferResult(xsb)); this.infoset = xsb; this.version = version; this.rootElement = new QName("EndpointReference", version.nsUri); parse(); } catch (XMLStreamException e) { throw new WebServiceException(ClientMessages.FAILED_TO_PARSE_EPR(epr),e); } }
Example #24
Source File: StreamReaderBufferCreator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Creates the buffer from a stream reader that is an element fragment. * <p> * The stream reader will be moved to the position of the next start of * an element if the stream reader is not already positioned at the start * of an element. * <p> * The element and all its children will be stored and after storing the stream * will be positioned at the next event after the end of the element. * <p> * @param storeInScopeNamespaces true if in-scope namespaces of the element * fragment should be stored. * @return the mutable stream buffer. * @throws XMLStreamException if the stream reader cannot be positioned at * the start of an element. */ public MutableXMLStreamBuffer createElementFragment(XMLStreamReader reader, boolean storeInScopeNamespaces) throws XMLStreamException { if (_buffer == null) { createBuffer(); } if (!reader.hasNext()) { return _buffer; } _storeInScopeNamespacesOnElementFragment = storeInScopeNamespaces; _eventType = reader.getEventType(); if (_eventType != XMLStreamReader.START_ELEMENT) { do { _eventType = reader.next(); } while(_eventType != XMLStreamReader.START_ELEMENT && _eventType != XMLStreamReader.END_DOCUMENT); } if (storeInScopeNamespaces) { _inScopePrefixes = new HashMap<String,Integer>(); } storeElementAndChildren(reader); return getXMLStreamBuffer(); }
Example #25
Source File: JAXBHeader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public XMLStreamReader readHeader() throws XMLStreamException { if(infoset==null) { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writeTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } return infoset.readAsXMLStreamReader(); }
Example #26
Source File: StreamMessage.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 #27
Source File: WSEndpointReference.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Creates from the spec version of {@link EndpointReference}. * * <p> * This method performs the data conversion, so it's slow. * Do not use this method in a performance critical path. */ public WSEndpointReference(EndpointReference epr, AddressingVersion version) { try { MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer(); epr.writeTo(new XMLStreamBufferResult(xsb)); this.infoset = xsb; this.version = version; this.rootElement = new QName("EndpointReference", version.nsUri); parse(); } catch (XMLStreamException e) { throw new WebServiceException(ClientMessages.FAILED_TO_PARSE_EPR(epr),e); } }
Example #28
Source File: StreamMessage.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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 #29
Source File: StreamMessage.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #30
Source File: StreamMessage.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static MutableXMLStreamBuffer createXMLStreamBuffer() { // TODO: Decode should own one MutableXMLStreamBuffer for reuse // since it is more efficient. ISSUE: possible issue with // lifetime of information in the buffer if accessed beyond // the pipe line. return new MutableXMLStreamBuffer(); }