1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/MessageHeaders.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,123 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.xml.internal.ws.api.message; 1.30 + 1.31 +import java.util.List; 1.32 +import java.util.Iterator; 1.33 +import java.util.Set; 1.34 + 1.35 +import javax.xml.namespace.QName; 1.36 + 1.37 +import com.sun.xml.internal.ws.api.WSBinding; 1.38 + 1.39 +/** 1.40 + * Interface representing all the headers of a {@link Message} 1.41 + */ 1.42 +public interface MessageHeaders { 1.43 + public void understood(Header header); 1.44 + public void understood(QName name); 1.45 + public void understood(String nsUri, String localName); 1.46 + public Header get(String nsUri, String localName, boolean markAsUnderstood); 1.47 + public Header get(QName name, boolean markAsUnderstood); 1.48 + public Iterator<Header> getHeaders(String nsUri, String localName, final boolean markAsUnderstood); 1.49 + /** 1.50 + * Get all headers in specified namespace 1.51 + * @param nsUri 1.52 + * @param markAsUnderstood 1.53 + * @return 1.54 + */ 1.55 + public Iterator<Header> getHeaders(String nsUri, final boolean markAsUnderstood); 1.56 + public Iterator<Header> getHeaders(QName headerName, final boolean markAsUnderstood); 1.57 + public Iterator<Header> getHeaders(); 1.58 + public boolean hasHeaders(); 1.59 + public boolean add(Header header); 1.60 + public Header remove(QName name); 1.61 + public Header remove(String nsUri, String localName); 1.62 + //DONT public Header remove(Header header); 1.63 + public void replace(Header old, Header header); 1.64 + 1.65 + /** 1.66 + * Replaces an existing {@link Header} or adds a new {@link Header}. 1.67 + * 1.68 + * <p> 1.69 + * Order doesn't matter in headers, so this method 1.70 + * does not make any guarantee as to where the new header 1.71 + * is inserted. 1.72 + * 1.73 + * @return 1.74 + * always true. Don't use the return value. 1.75 + */ 1.76 + public boolean addOrReplace(Header header); 1.77 + 1.78 + /** 1.79 + * Return a Set of QNames of headers that have been explicitly marked as understood. 1.80 + * If none have been marked, this method could return null 1.81 + */ 1.82 + public Set<QName> getUnderstoodHeaders(); 1.83 + 1.84 + /** 1.85 + * Returns a Set of QNames of headers that satisfy ALL the following conditions: 1.86 + * (a) Have mustUnderstand = true 1.87 + * (b) have NOT been explicitly marked as understood 1.88 + * (c) If roles argument is non-null, the header has isIgnorable = false 1.89 + * for the roles argument and SOAP version 1.90 + * (d) If non-null binding is passed in, are NOT understood by the binding 1.91 + * (e) If (d) is met, the header is NOT in the knownHeaders list passed in 1.92 + * 1.93 + * @param roles 1.94 + * @param knownHeaders 1.95 + * @param binding 1.96 + * @return 1.97 + */ 1.98 + public Set<QName> getNotUnderstoodHeaders(Set<String> roles, Set<QName> knownHeaders, WSBinding binding); 1.99 + 1.100 + /** 1.101 + * True if the header has been explicitly marked understood, false otherwise 1.102 + * @param header 1.103 + * @return 1.104 + */ 1.105 + public boolean isUnderstood(Header header); 1.106 + 1.107 + /** 1.108 + * True if the header has been explicitly marked understood, false otherwise 1.109 + * @param header 1.110 + * @return 1.111 + */ 1.112 + public boolean isUnderstood(QName header); 1.113 + 1.114 + /** 1.115 + * True if the header has been explicitly marked understood, false otherwise 1.116 + * @param header 1.117 + * @return 1.118 + */ 1.119 + public boolean isUnderstood(String nsUri, String header); 1.120 + 1.121 + /** 1.122 + * Returns <code>Header</code> instances in a <code>List</code>. 1.123 + * @return <code>List</code> containing <code>Header</code> instances 1.124 + */ 1.125 + public List<Header> asList(); 1.126 +}