1/* 2 * Copyright (c) 1997, 2013, 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 */ 25 26package com.sun.xml.internal.ws.api.message; 27 28import java.util.List; 29import java.util.Iterator; 30import java.util.Set; 31 32import javax.xml.namespace.QName; 33 34import com.sun.xml.internal.ws.api.WSBinding; 35 36/** 37 * Interface representing all the headers of a {@link Message} 38 */ 39public interface MessageHeaders { 40 public void understood(Header header); 41 public void understood(QName name); 42 public void understood(String nsUri, String localName); 43 public Header get(String nsUri, String localName, boolean markAsUnderstood); 44 public Header get(QName name, boolean markAsUnderstood); 45 public Iterator<Header> getHeaders(String nsUri, String localName, final boolean markAsUnderstood); 46 /** 47 * Get all headers in specified namespace 48 * @param nsUri 49 * @param markAsUnderstood 50 * @return 51 */ 52 public Iterator<Header> getHeaders(String nsUri, final boolean markAsUnderstood); 53 public Iterator<Header> getHeaders(QName headerName, final boolean markAsUnderstood); 54 public Iterator<Header> getHeaders(); 55 public boolean hasHeaders(); 56 public boolean add(Header header); 57 public Header remove(QName name); 58 public Header remove(String nsUri, String localName); 59 //DONT public Header remove(Header header); 60 public void replace(Header old, Header header); 61 62 /** 63 * Replaces an existing {@link Header} or adds a new {@link Header}. 64 * 65 * <p> 66 * Order doesn't matter in headers, so this method 67 * does not make any guarantee as to where the new header 68 * is inserted. 69 * 70 * @return 71 * always true. Don't use the return value. 72 */ 73 public boolean addOrReplace(Header header); 74 75 /** 76 * Return a Set of QNames of headers that have been explicitly marked as understood. 77 * If none have been marked, this method could return null 78 */ 79 public Set<QName> getUnderstoodHeaders(); 80 81 /** 82 * Returns a Set of QNames of headers that satisfy ALL the following conditions: 83 * (a) Have mustUnderstand = true 84 * (b) have NOT been explicitly marked as understood 85 * (c) If roles argument is non-null, the header has isIgnorable = false 86 * for the roles argument and SOAP version 87 * (d) If non-null binding is passed in, are NOT understood by the binding 88 * (e) If (d) is met, the header is NOT in the knownHeaders list passed in 89 * 90 * @param roles 91 * @param knownHeaders 92 * @param binding 93 * @return 94 */ 95 public Set<QName> getNotUnderstoodHeaders(Set<String> roles, Set<QName> knownHeaders, WSBinding binding); 96 97 /** 98 * True if the header has been explicitly marked understood, false otherwise 99 * @param header 100 * @return 101 */ 102 public boolean isUnderstood(Header header); 103 104 /** 105 * True if the header has been explicitly marked understood, false otherwise 106 * @param header 107 * @return 108 */ 109 public boolean isUnderstood(QName header); 110 111 /** 112 * True if the header has been explicitly marked understood, false otherwise 113 * @param header 114 * @return 115 */ 116 public boolean isUnderstood(String nsUri, String header); 117 118 /** 119 * Returns <code>Header</code> instances in a <code>List</code>. 120 * @return <code>List</code> containing <code>Header</code> instances 121 */ 122 public List<Header> asList(); 123} 124