Java Code Examples for javax.xml.soap.SOAPHeader#examineAllHeaderElements()

The following examples show how to use javax.xml.soap.SOAPHeader#examineAllHeaderElements() . 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: SAAJMessageHeaders.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** Set the initial understood/not understood state of the headers in this
 * object
 */
private void initHeaderUnderstanding() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return;
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    while(allHeaders.hasNext()) {
        SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next();
        if (nextHdrElem == null) {
            continue;
        }
        if (nextHdrElem.getMustUnderstand()) {
            notUnderstood(nextHdrElem.getElementQName());
        }
        //only headers explicitly marked as understood should be
        //in the understoodHeaders set, so don't add anything to
        //that set at the beginning
    }

}
 
Example 2
Source File: SAAJMessageHeaders.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** Set the initial understood/not understood state of the headers in this
 * object
 */
private void initHeaderUnderstanding() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return;
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    while(allHeaders.hasNext()) {
        SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next();
        if (nextHdrElem == null) {
            continue;
        }
        if (nextHdrElem.getMustUnderstand()) {
            notUnderstood(nextHdrElem.getElementQName());
        }
        //only headers explicitly marked as understood should be
        //in the understoodHeaders set, so don't add anything to
        //that set at the beginning
    }

}
 
Example 3
Source File: SAAJMessageHeaders.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 4
Source File: SAAJMessageHeaders.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Iterator<Header> getHeaders(final String nsUri, final String localName,
        final boolean markAsUnderstood) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    if (markAsUnderstood) {
        //mark all the matchingheaders as understood up front
        //make an iterator while we're doing that
        List<Header> headers = new ArrayList<Header>();
        while (allHeaders.hasNext()) {
            SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
            if (nextHdr != null &&
                    nextHdr.getNamespaceURI().equals(nsUri)) {
                if (localName == null ||
                        nextHdr.getLocalName().equals(localName)) {
                    understood(nextHdr.getNamespaceURI(), nextHdr.getLocalName());
                    headers.add(new SAAJHeader(nextHdr));
                }
            }
        }
        return headers.iterator();
    }
    //if we got here markAsUnderstood is false - return a lazy iterator rather
    //than traverse the entire list of headers now
    return new HeaderReadIterator(allHeaders, nsUri, localName);
}
 
Example 5
Source File: SAAJMessageHeaders.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 6
Source File: SAAJMessageHeaders.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 7
Source File: SAAJMessageHeaders.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean hasHeaders() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return false;
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    return allHeaders.hasNext();
}
 
Example 8
Source File: SAAJMessageHeaders.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Iterator<Header> getHeaders(final String nsUri, final String localName,
        final boolean markAsUnderstood) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    if (markAsUnderstood) {
        //mark all the matchingheaders as understood up front
        //make an iterator while we're doing that
        List<Header> headers = new ArrayList<Header>();
        while (allHeaders.hasNext()) {
            SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
            if (nextHdr != null &&
                    nextHdr.getNamespaceURI().equals(nsUri)) {
                if (localName == null ||
                        nextHdr.getLocalName().equals(localName)) {
                    understood(nextHdr.getNamespaceURI(), nextHdr.getLocalName());
                    headers.add(new SAAJHeader(nextHdr));
                }
            }
        }
        return headers.iterator();
    }
    //if we got here markAsUnderstood is false - return a lazy iterator rather
    //than traverse the entire list of headers now
    return new HeaderReadIterator(allHeaders, nsUri, localName);
}
 
Example 9
Source File: SAAJMessageHeaders.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private SOAPHeaderElement find(String nsUri, String localName) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    while(allHeaders.hasNext()) {
        SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next();
        if (nextHdrElem.getNamespaceURI().equals(nsUri) &&
                nextHdrElem.getLocalName().equals(localName)) {
            return nextHdrElem;
        }
    }
    return null;
}
 
Example 10
Source File: SAAJMessageHeaders.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 11
Source File: SAAJMessageHeaders.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 12
Source File: SAAJMessageHeaders.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 13
Source File: SAAJMessageHeaders.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Iterator<Header> getHeaders() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    return new HeaderReadIterator(allHeaders, null, null);
}
 
Example 14
Source File: SAAJMessageHeaders.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private SOAPHeaderElement find(String nsUri, String localName) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    while(allHeaders.hasNext()) {
        SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next();
        if (nextHdrElem.getNamespaceURI().equals(nsUri) &&
                nextHdrElem.getLocalName().equals(localName)) {
            return nextHdrElem;
        }
    }
    return null;
}
 
Example 15
Source File: SAAJMessageHeaders.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Iterator<Header> getHeaders(final String nsUri, final String localName,
        final boolean markAsUnderstood) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    if (markAsUnderstood) {
        //mark all the matchingheaders as understood up front
        //make an iterator while we're doing that
        List<Header> headers = new ArrayList<Header>();
        while (allHeaders.hasNext()) {
            SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
            if (nextHdr != null &&
                    nextHdr.getNamespaceURI().equals(nsUri)) {
                if (localName == null ||
                        nextHdr.getLocalName().equals(localName)) {
                    understood(nextHdr.getNamespaceURI(), nextHdr.getLocalName());
                    headers.add(new SAAJHeader(nextHdr));
                }
            }
        }
        return headers.iterator();
    }
    //if we got here markAsUnderstood is false - return a lazy iterator rather
    //than traverse the entire list of headers now
    return new HeaderReadIterator(allHeaders, nsUri, localName);
}
 
Example 16
Source File: SAAJMessageHeaders.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private SOAPHeaderElement find(String nsUri, String localName) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    while(allHeaders.hasNext()) {
        SOAPHeaderElement nextHdrElem = (SOAPHeaderElement) allHeaders.next();
        if (nextHdrElem.getNamespaceURI().equals(nsUri) &&
                nextHdrElem.getLocalName().equals(localName)) {
            return nextHdrElem;
        }
    }
    return null;
}
 
Example 17
Source File: SAAJMessageHeaders.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<Header> asList() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return Collections.emptyList();
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    List<Header> headers = new ArrayList<Header>();
    while (allHeaders.hasNext()) {
        SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
        headers.add(new SAAJHeader(nextHdr));
    }
    return headers;
}
 
Example 18
Source File: SAAJMessageHeaders.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean hasHeaders() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return false;
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    return allHeaders.hasNext();
}
 
Example 19
Source File: SAAJMessageHeaders.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean hasHeaders() {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return false;
    }

    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    return allHeaders.hasNext();
}
 
Example 20
Source File: SAAJMessageHeaders.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Iterator<Header> getHeaders(final String nsUri, final String localName,
        final boolean markAsUnderstood) {
    SOAPHeader soapHeader = ensureSOAPHeader();
    if (soapHeader == null) {
        return null;
    }
    Iterator allHeaders = soapHeader.examineAllHeaderElements();
    if (markAsUnderstood) {
        //mark all the matchingheaders as understood up front
        //make an iterator while we're doing that
        List<Header> headers = new ArrayList<Header>();
        while (allHeaders.hasNext()) {
            SOAPHeaderElement nextHdr = (SOAPHeaderElement) allHeaders.next();
            if (nextHdr != null &&
                    nextHdr.getNamespaceURI().equals(nsUri)) {
                if (localName == null ||
                        nextHdr.getLocalName().equals(localName)) {
                    understood(nextHdr.getNamespaceURI(), nextHdr.getLocalName());
                    headers.add(new SAAJHeader(nextHdr));
                }
            }
        }
        return headers.iterator();
    }
    //if we got here markAsUnderstood is false - return a lazy iterator rather
    //than traverse the entire list of headers now
    return new HeaderReadIterator(allHeaders, nsUri, localName);
}