com.sun.xml.ws.message.stream.StreamHeader12 Maven / Gradle / Ivy
/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the license at
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at https://glassfish.dev.java.net/public/CDDLv1.0.html.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* you own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Copyright 2006 Sun Microsystems Inc. All Rights Reserved
*/
package com.sun.xml.ws.message.stream;
import com.sun.xml.stream.buffer.XMLStreamBuffer;
import com.sun.xml.ws.message.Util;
import com.sun.istack.FinalArrayList;
import javax.xml.soap.SOAPConstants;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamException;
/**
* {@link StreamHeader} for SOAP 1.2.
*
* @author [email protected]
*/
@SuppressWarnings({"StringEquality"})
public class StreamHeader12 extends StreamHeader {
protected static final String SOAP_1_2_MUST_UNDERSTAND = "mustUnderstand";
protected static final String SOAP_1_2_ROLE = "role";
protected static final String SOAP_1_2_RELAY = "relay";
public StreamHeader12(XMLStreamReader reader, XMLStreamBuffer mark) {
super(reader, mark);
}
public StreamHeader12(XMLStreamReader reader) throws XMLStreamException {
super(reader);
}
protected final FinalArrayList processHeaderAttributes(XMLStreamReader reader) {
FinalArrayList atts = null;
_role = SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER;
for (int i = 0; i < reader.getAttributeCount(); i++) {
final String localName = reader.getAttributeLocalName(i);
final String namespaceURI = reader.getAttributeNamespace(i);
final String value = reader.getAttributeValue(i);
if (namespaceURI == SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE) {
if (localName == SOAP_1_2_MUST_UNDERSTAND) {
_isMustUnderstand = Util.parseBool(value);
} else if (localName == SOAP_1_2_ROLE) {
if (value != null && value.length() > 0) {
_role = value;
}
} else if (localName == SOAP_1_2_RELAY) {
_isRelay = Util.parseBool(value);
}
}
if(atts==null) {
atts = new FinalArrayList();
}
atts.add(new Attribute(namespaceURI,localName,value));
}
return atts;
}
}