< prev index next >

jaxws/src/java.xml.ws/share/classes/javax/xml/soap/AttachmentPart.java

Print this page


   1 /*
   2  * Copyright (c) 2004, 2015, 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 
  26 package javax.xml.soap;
  27 
  28 import java.io.InputStream;
  29 import java.io.Reader;
  30 import java.util.Iterator;
  31 
  32 import javax.activation.DataHandler;
  33 
  34 /**
  35  * A single attachment to a {@code SOAPMessage} object. A {@code SOAPMessage}
  36  * object may contain zero, one, or many {@code AttachmentPart} objects.
  37  * Each {@code AttachmentPart} object consists of two parts,
  38  * application-specific content and associated MIME headers. The
  39  * MIME headers consists of name/value pairs that can be used to
  40  * identify and describe the content.
  41  * <p>
  42  * An {@code AttachmentPart} object must conform to certain standards.
  43  * <OL>
  44  * <LI>It must conform to <a href="http://www.ietf.org/rfc/rfc2045.txt">
  45  *     MIME [RFC2045] standards</a>
  46  * <LI>It MUST contain content
  47  * <LI>The header portion MUST include the following header:
  48  *  <UL>
  49  *   <LI>{@code Content-Type}<br>


 482      * <p>
 483      * Note that RFC822 headers can contain only US-ASCII characters.
 484      *
 485      * @param   name    a {@code String} giving the name of the header
 486      *                  to be added
 487      * @param   value   a {@code String} giving the value of the header
 488      *                  to be added
 489      *
 490      * @exception IllegalArgumentException if there was a problem with
 491      *            the specified mime header name or value
 492      */
 493     public abstract void addMimeHeader(String name, String value);
 494 
 495     /**
 496      * Retrieves all the headers for this {@code AttachmentPart} object
 497      * as an iterator over the {@code MimeHeader} objects.
 498      *
 499      * @return  an {@code Iterator} object with all of the Mime
 500      *          headers for this {@code AttachmentPart} object
 501      */
 502     public abstract Iterator getAllMimeHeaders();
 503 
 504     /**
 505      * Retrieves all {@code MimeHeader} objects that match a name in
 506      * the given array.
 507      *
 508      * @param names a {@code String} array with the name(s) of the
 509      *        MIME headers to be returned
 510      * @return  all of the MIME headers that match one of the names in the
 511      *           given array as an {@code Iterator} object
 512      */
 513     public abstract Iterator getMatchingMimeHeaders(String[] names);
 514 
 515     /**
 516      * Retrieves all {@code MimeHeader} objects whose name does
 517      * not match a name in the given array.
 518      *
 519      * @param names a {@code String} array with the name(s) of the
 520      *        MIME headers not to be returned
 521      * @return  all of the MIME headers in this {@code AttachmentPart} object
 522      *          except those that match one of the names in the
 523      *           given array.  The nonmatching MIME headers are returned as an
 524      *           {@code Iterator} object.
 525      */
 526     public abstract Iterator getNonMatchingMimeHeaders(String[] names);
 527 }
   1 /*
   2  * Copyright (c) 2004, 2017, 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 
  26 package javax.xml.soap;
  27 
  28 import java.io.InputStream;

  29 import java.util.Iterator;
  30 
  31 import javax.activation.DataHandler;
  32 
  33 /**
  34  * A single attachment to a {@code SOAPMessage} object. A {@code SOAPMessage}
  35  * object may contain zero, one, or many {@code AttachmentPart} objects.
  36  * Each {@code AttachmentPart} object consists of two parts,
  37  * application-specific content and associated MIME headers. The
  38  * MIME headers consists of name/value pairs that can be used to
  39  * identify and describe the content.
  40  * <p>
  41  * An {@code AttachmentPart} object must conform to certain standards.
  42  * <OL>
  43  * <LI>It must conform to <a href="http://www.ietf.org/rfc/rfc2045.txt">
  44  *     MIME [RFC2045] standards</a>
  45  * <LI>It MUST contain content
  46  * <LI>The header portion MUST include the following header:
  47  *  <UL>
  48  *   <LI>{@code Content-Type}<br>


 481      * <p>
 482      * Note that RFC822 headers can contain only US-ASCII characters.
 483      *
 484      * @param   name    a {@code String} giving the name of the header
 485      *                  to be added
 486      * @param   value   a {@code String} giving the value of the header
 487      *                  to be added
 488      *
 489      * @exception IllegalArgumentException if there was a problem with
 490      *            the specified mime header name or value
 491      */
 492     public abstract void addMimeHeader(String name, String value);
 493 
 494     /**
 495      * Retrieves all the headers for this {@code AttachmentPart} object
 496      * as an iterator over the {@code MimeHeader} objects.
 497      *
 498      * @return  an {@code Iterator} object with all of the Mime
 499      *          headers for this {@code AttachmentPart} object
 500      */
 501     public abstract Iterator<MimeHeader> getAllMimeHeaders();
 502 
 503     /**
 504      * Retrieves all {@code MimeHeader} objects that match a name in
 505      * the given array.
 506      *
 507      * @param names a {@code String} array with the name(s) of the
 508      *        MIME headers to be returned
 509      * @return  all of the MIME headers that match one of the names in the
 510      *           given array as an {@code Iterator} object
 511      */
 512     public abstract Iterator<MimeHeader> getMatchingMimeHeaders(String[] names);
 513 
 514     /**
 515      * Retrieves all {@code MimeHeader} objects whose name does
 516      * not match a name in the given array.
 517      *
 518      * @param names a {@code String} array with the name(s) of the
 519      *        MIME headers not to be returned
 520      * @return  all of the MIME headers in this {@code AttachmentPart} object
 521      *          except those that match one of the names in the
 522      *           given array.  The nonmatching MIME headers are returned as an
 523      *           {@code Iterator} object.
 524      */
 525     public abstract Iterator<MimeHeader> getNonMatchingMimeHeaders(String[] names);
 526 }
< prev index next >