< prev index next >
src/java.xml.ws/share/classes/javax/xml/soap/MimeHeaders.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 27,65 ****
import java.util.Iterator;
import java.util.Vector;
/**
! * A container for <code>MimeHeader</code> objects, which represent
* the MIME headers present in a MIME part of a message.
*
* <p>This class is used primarily when an application wants to
* retrieve specific attachments based on certain MIME headers and
* values. This class will most likely be used by implementations of
! * <code>AttachmentPart</code> and other MIME dependent parts of the SAAJ
* API.
* @see SOAPMessage#getAttachments
* @see AttachmentPart
* @since 1.6
*/
public class MimeHeaders {
private Vector headers;
/**
! * Constructs a default <code>MimeHeaders</code> object initialized with
! * an empty <code>Vector</code> object.
*/
public MimeHeaders() {
headers = new Vector();
}
/**
* Returns all of the values for the specified header as an array of
! * <code>String</code> objects.
*
* @param name the name of the header for which values will be returned
! * @return a <code>String</code> array with all of the values for the
* specified header
* @see #setHeader
*/
public String[] getHeader(String name) {
Vector values = new Vector();
--- 27,65 ----
import java.util.Iterator;
import java.util.Vector;
/**
! * A container for {@code MimeHeader} objects, which represent
* the MIME headers present in a MIME part of a message.
*
* <p>This class is used primarily when an application wants to
* retrieve specific attachments based on certain MIME headers and
* values. This class will most likely be used by implementations of
! * {@code AttachmentPart} and other MIME dependent parts of the SAAJ
* API.
* @see SOAPMessage#getAttachments
* @see AttachmentPart
* @since 1.6
*/
public class MimeHeaders {
private Vector headers;
/**
! * Constructs a default {@code MimeHeaders} object initialized with
! * an empty {@code Vector} object.
*/
public MimeHeaders() {
headers = new Vector();
}
/**
* Returns all of the values for the specified header as an array of
! * {@code String} objects.
*
* @param name the name of the header for which values will be returned
! * @return a {@code String} array with all of the values for the
* specified header
* @see #setHeader
*/
public String[] getHeader(String name) {
Vector values = new Vector();
*** 84,96 ****
* the given name with the given value, adding a new header if no existing header
* name matches. This method also removes all matching headers after the first one.
* <P>
* Note that RFC822 headers can contain only US-ASCII characters.
*
! * @param name a <code>String</code> with the name of the header for
* which to search
! * @param value a <code>String</code> with the value that will replace the
* current value of the specified header
*
* @exception IllegalArgumentException if there was a problem in the
* mime header name or the value being set
* @see #getHeader
--- 84,96 ----
* the given name with the given value, adding a new header if no existing header
* name matches. This method also removes all matching headers after the first one.
* <P>
* Note that RFC822 headers can contain only US-ASCII characters.
*
! * @param name a {@code String} with the name of the header for
* which to search
! * @param value a {@code String} with the value that will replace the
* current value of the specified header
*
* @exception IllegalArgumentException if there was a problem in the
* mime header name or the value being set
* @see #getHeader
*** 118,135 ****
if (!found)
addHeader(name, value);
}
/**
! * Adds a <code>MimeHeader</code> object with the specified name and value
! * to this <code>MimeHeaders</code> object's list of headers.
* <P>
* Note that RFC822 headers can contain only US-ASCII characters.
*
! * @param name a <code>String</code> with the name of the header to
* be added
! * @param value a <code>String</code> with the value of the header to
* be added
*
* @exception IllegalArgumentException if there was a problem in the
* mime header name or value being added
*/
--- 118,135 ----
if (!found)
addHeader(name, value);
}
/**
! * Adds a {@code MimeHeader} object with the specified name and value
! * to this {@code MimeHeaders} object's list of headers.
* <P>
* Note that RFC822 headers can contain only US-ASCII characters.
*
! * @param name a {@code String} with the name of the header to
* be added
! * @param value a {@code String} with the value of the header to
* be added
*
* @exception IllegalArgumentException if there was a problem in the
* mime header name or value being added
*/
*** 150,163 ****
}
headers.addElement(new MimeHeader(name, value));
}
/**
! * Remove all <code>MimeHeader</code> objects whose name matches the
* given name.
*
! * @param name a <code>String</code> with the name of the header for
* which to search
*/
public void removeHeader(String name) {
for(int i = 0; i < headers.size(); i++) {
MimeHeader hdr = (MimeHeader) headers.elementAt(i);
--- 150,163 ----
}
headers.addElement(new MimeHeader(name, value));
}
/**
! * Remove all {@code MimeHeader} objects whose name matches the
* given name.
*
! * @param name a {@code String} with the name of the header for
* which to search
*/
public void removeHeader(String name) {
for(int i = 0; i < headers.size(); i++) {
MimeHeader hdr = (MimeHeader) headers.elementAt(i);
*** 165,186 ****
headers.removeElementAt(i--);
}
}
/**
! * Removes all the header entries from this <code>MimeHeaders</code> object.
*/
public void removeAllHeaders() {
headers.removeAllElements();
}
/**
! * Returns all the <code>MimeHeader</code>s in this <code>MimeHeaders</code> object.
*
! * @return an <code>Iterator</code> object over this <code>MimeHeaders</code>
! * object's list of <code>MimeHeader</code> objects
*/
public Iterator getAllHeaders() {
return headers.iterator();
}
--- 165,186 ----
headers.removeElementAt(i--);
}
}
/**
! * Removes all the header entries from this {@code MimeHeaders} object.
*/
public void removeAllHeaders() {
headers.removeAllElements();
}
/**
! * Returns all the {@code MimeHeader}s in this {@code MimeHeaders} object.
*
! * @return an {@code Iterator} object over this {@code MimeHeaders}
! * object's list of {@code MimeHeader} objects
*/
public Iterator getAllHeaders() {
return headers.iterator();
}
*** 241,269 ****
}
}
/**
! * Returns all the <code>MimeHeader</code> objects whose name matches
* a name in the given array of names.
*
! * @param names an array of <code>String</code> objects with the names
* for which to search
! * @return an <code>Iterator</code> object over the <code>MimeHeader</code>
* objects whose name matches one of the names in the given list
*/
public Iterator getMatchingHeaders(String[] names) {
return new MatchingIterator(names, true);
}
/**
! * Returns all of the <code>MimeHeader</code> objects whose name does not
* match a name in the given array of names.
*
! * @param names an array of <code>String</code> objects with the names
* for which to search
! * @return an <code>Iterator</code> object over the <code>MimeHeader</code>
* objects whose name does not match one of the names in the given list
*/
public Iterator getNonMatchingHeaders(String[] names) {
return new MatchingIterator(names, false);
}
--- 241,269 ----
}
}
/**
! * Returns all the {@code MimeHeader} objects whose name matches
* a name in the given array of names.
*
! * @param names an array of {@code String} objects with the names
* for which to search
! * @return an {@code Iterator} object over the {@code MimeHeader}
* objects whose name matches one of the names in the given list
*/
public Iterator getMatchingHeaders(String[] names) {
return new MatchingIterator(names, true);
}
/**
! * Returns all of the {@code MimeHeader} objects whose name does not
* match a name in the given array of names.
*
! * @param names an array of {@code String} objects with the names
* for which to search
! * @return an {@code Iterator} object over the {@code MimeHeader}
* objects whose name does not match one of the names in the given list
*/
public Iterator getNonMatchingHeaders(String[] names) {
return new MatchingIterator(names, false);
}
< prev index next >