Java Code Examples for com.sun.xml.internal.ws.api.message.HeaderList#add()

The following examples show how to use com.sun.xml.internal.ws.api.message.HeaderList#add() . 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: StreamMessage.java    From TencentKona-8 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 2
Source File: WSEndpointReference.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
Example 3
Source File: StreamMessage.java    From jdk8u60 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 4
Source File: WSEndpointReference.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
Example 5
Source File: StreamMessage.java    From openjdk-jdk8u 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 6
Source File: WSEndpointReference.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
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: WSEndpointReference.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
Example 9
Source File: StreamMessage.java    From openjdk-jdk9 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 10
Source File: WSEndpointReference.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
Example 11
Source File: StreamMessage.java    From hottub 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 12
Source File: WSEndpointReference.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
Example 13
Source File: StreamMessage.java    From openjdk-8-source 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 14
Source File: WSEndpointReference.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}
 
Example 15
Source File: StreamMessage.java    From openjdk-8 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 16
Source File: WSEndpointReference.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies all the reference parameters in this EPR as headers
 * to the given {@link HeaderList}.
 * @deprecated - use addReferenceParametersToList(MessageHeaders)
 */
@SuppressWarnings("ManualArrayToCollectionCopy")
public void addReferenceParametersToList(HeaderList outbound) {
    // implemented through iteration because of unsupportedoperation exception thrown from addAll method on headerlist
    // do not change
    for (Header header : referenceParameters) {
        outbound.add(header);
    }
}