Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.ws.message.stream;
28 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
29 import com.sun.xml.internal.ws.message.Util;
30 import com.sun.istack.internal.FinalArrayList;
32 import javax.xml.soap.SOAPConstants;
33 import javax.xml.stream.XMLStreamReader;
34 import javax.xml.stream.XMLStreamException;
36 /**
37 * {@link StreamHeader} for SOAP 1.2.
38 *
39 * @author Paul.Sandoz@Sun.Com
40 */
41 @SuppressWarnings({"StringEquality"})
42 public class StreamHeader12 extends StreamHeader {
43 protected static final String SOAP_1_2_MUST_UNDERSTAND = "mustUnderstand";
45 protected static final String SOAP_1_2_ROLE = "role";
47 protected static final String SOAP_1_2_RELAY = "relay";
49 public StreamHeader12(XMLStreamReader reader, XMLStreamBuffer mark) {
50 super(reader, mark);
51 }
53 public StreamHeader12(XMLStreamReader reader) throws XMLStreamException {
54 super(reader);
55 }
57 protected final FinalArrayList<Attribute> processHeaderAttributes(XMLStreamReader reader) {
58 FinalArrayList<Attribute> atts = null;
60 _role = SOAPConstants.URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER;
62 for (int i = 0; i < reader.getAttributeCount(); i++) {
63 final String localName = reader.getAttributeLocalName(i);
64 final String namespaceURI = reader.getAttributeNamespace(i);
65 final String value = reader.getAttributeValue(i);
67 if (SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(namespaceURI)) {
68 if (SOAP_1_2_MUST_UNDERSTAND.equals(localName)) {
69 _isMustUnderstand = Util.parseBool(value);
70 } else if (SOAP_1_2_ROLE.equals(localName)) {
71 if (value != null && value.length() > 0) {
72 _role = value;
73 }
74 } else if (SOAP_1_2_RELAY.equals(localName)) {
75 _isRelay = Util.parseBool(value);
76 }
77 }
79 if(atts==null) {
80 atts = new FinalArrayList<Attribute>();
81 }
82 atts.add(new Attribute(namespaceURI,localName,value));
83 }
85 return atts;
86 }
88 }