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
188 * <p>
189 * This method does not touch the SOAP part.
190 */
191 public abstract void removeAllAttachments();
192
193 /**
194 * Gets a count of the number of attachments in this message. This count
195 * does not include the SOAP part.
196 *
197 * @return the number of {@code AttachmentPart} objects that are
198 * part of this {@code SOAPMessage} object
199 */
200 public abstract int countAttachments();
201
202 /**
203 * Retrieves all the {@code AttachmentPart} objects that are part of
204 * this {@code SOAPMessage} object.
205 *
206 * @return an iterator over all the attachments in this message
207 */
208 public abstract Iterator getAttachments();
209
210 /**
211 * Retrieves all the {@code AttachmentPart} objects that have header
212 * entries that match the specified headers. Note that a returned
213 * attachment could have headers in addition to those specified.
214 *
215 * @param headers a {@code MimeHeaders} object containing the MIME
216 * headers for which to search
217 * @return an iterator over all attachments that have a header that matches
218 * one of the given headers
219 */
220 public abstract Iterator getAttachments(MimeHeaders headers);
221
222 /**
223 * Removes all the {@code AttachmentPart} objects that have header
224 * entries that match the specified headers. Note that the removed
225 * attachment could have headers in addition to those specified.
226 *
227 * @param headers
228 * a {@code MimeHeaders} object containing the MIME
229 * headers for which to search
230 * @since 1.6, SAAJ 1.3
231 */
232 public abstract void removeAttachments(MimeHeaders headers);
233
234
235 /**
236 * Returns an {@code AttachmentPart} object that is associated with an
237 * attachment that is referenced by this {@code SOAPElement} or
238 * {@code null} if no such attachment exists. References can be made
239 * via an {@code href} attribute as described in
240 * <a href="http://www.w3.org/TR/SOAP-attachments#SOAPReferenceToAttachements">SOAP Messages with Attachments</a>,
249 * other reference mechanisms may be supported by individual
250 * implementations of this standard. Contact your vendor for details.
251 *
252 * @param element The {@code SOAPElement} containing the reference to an Attachment
253 * @return the referenced {@code AttachmentPart} or null if no such
254 * {@code AttachmentPart} exists or no reference can be
255 * found in this {@code SOAPElement}.
256 * @throws SOAPException if there is an error in the attempt to access the
257 * attachment
258 *
259 * @since 1.6, SAAJ 1.3
260 */
261 public abstract AttachmentPart getAttachment(SOAPElement element) throws SOAPException;
262
263
264 /**
265 * Adds the given {@code AttachmentPart} object to this {@code SOAPMessage}
266 * object. An {@code AttachmentPart} object must be created before
267 * it can be added to a message.
268 *
269 * @param AttachmentPart
270 * an {@code AttachmentPart} object that is to become part
271 * of this {@code SOAPMessage} object
272 * @exception IllegalArgumentException
273 */
274 public abstract void addAttachmentPart(AttachmentPart AttachmentPart);
275
276 /**
277 * Creates a new empty {@code AttachmentPart} object. Note that the
278 * method {@code addAttachmentPart} must be called with this new
279 * {@code AttachmentPart} object as the parameter in order for it to
280 * become an attachment to this {@code SOAPMessage} object.
281 *
282 * @return a new {@code AttachmentPart} object that can be populated
283 * and added to this {@code SOAPMessage} object
284 */
285 public abstract AttachmentPart createAttachmentPart();
286
287 /**
288 * Creates an {@code AttachmentPart} object and populates it using
289 * the given {@code DataHandler} object.
290 *
291 * @param dataHandler
292 * the {@code javax.activation.DataHandler} object that
293 * will generate the content for this {@code SOAPMessage}
294 * object
|
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
188 * <p>
189 * This method does not touch the SOAP part.
190 */
191 public abstract void removeAllAttachments();
192
193 /**
194 * Gets a count of the number of attachments in this message. This count
195 * does not include the SOAP part.
196 *
197 * @return the number of {@code AttachmentPart} objects that are
198 * part of this {@code SOAPMessage} object
199 */
200 public abstract int countAttachments();
201
202 /**
203 * Retrieves all the {@code AttachmentPart} objects that are part of
204 * this {@code SOAPMessage} object.
205 *
206 * @return an iterator over all the attachments in this message
207 */
208 public abstract Iterator<AttachmentPart> getAttachments();
209
210 /**
211 * Retrieves all the {@code AttachmentPart} objects that have header
212 * entries that match the specified headers. Note that a returned
213 * attachment could have headers in addition to those specified.
214 *
215 * @param headers a {@code MimeHeaders} object containing the MIME
216 * headers for which to search
217 * @return an iterator over all attachments that have a header that matches
218 * one of the given headers
219 */
220 public abstract Iterator<AttachmentPart> getAttachments(MimeHeaders headers);
221
222 /**
223 * Removes all the {@code AttachmentPart} objects that have header
224 * entries that match the specified headers. Note that the removed
225 * attachment could have headers in addition to those specified.
226 *
227 * @param headers
228 * a {@code MimeHeaders} object containing the MIME
229 * headers for which to search
230 * @since 1.6, SAAJ 1.3
231 */
232 public abstract void removeAttachments(MimeHeaders headers);
233
234
235 /**
236 * Returns an {@code AttachmentPart} object that is associated with an
237 * attachment that is referenced by this {@code SOAPElement} or
238 * {@code null} if no such attachment exists. References can be made
239 * via an {@code href} attribute as described in
240 * <a href="http://www.w3.org/TR/SOAP-attachments#SOAPReferenceToAttachements">SOAP Messages with Attachments</a>,
249 * other reference mechanisms may be supported by individual
250 * implementations of this standard. Contact your vendor for details.
251 *
252 * @param element The {@code SOAPElement} containing the reference to an Attachment
253 * @return the referenced {@code AttachmentPart} or null if no such
254 * {@code AttachmentPart} exists or no reference can be
255 * found in this {@code SOAPElement}.
256 * @throws SOAPException if there is an error in the attempt to access the
257 * attachment
258 *
259 * @since 1.6, SAAJ 1.3
260 */
261 public abstract AttachmentPart getAttachment(SOAPElement element) throws SOAPException;
262
263
264 /**
265 * Adds the given {@code AttachmentPart} object to this {@code SOAPMessage}
266 * object. An {@code AttachmentPart} object must be created before
267 * it can be added to a message.
268 *
269 * @param attachmentPart
270 * an {@code attachmentPart} object that is to become part
271 * of this {@code SOAPMessage} object
272 * @exception IllegalArgumentException
273 * if there was a problem with the specified {@code attachmentPart}
274 * object
275 */
276 public abstract void addAttachmentPart(AttachmentPart attachmentPart);
277
278 /**
279 * Creates a new empty {@code AttachmentPart} object. Note that the
280 * method {@code addAttachmentPart} must be called with this new
281 * {@code AttachmentPart} object as the parameter in order for it to
282 * become an attachment to this {@code SOAPMessage} object.
283 *
284 * @return a new {@code AttachmentPart} object that can be populated
285 * and added to this {@code SOAPMessage} object
286 */
287 public abstract AttachmentPart createAttachmentPart();
288
289 /**
290 * Creates an {@code AttachmentPart} object and populates it using
291 * the given {@code DataHandler} object.
292 *
293 * @param dataHandler
294 * the {@code javax.activation.DataHandler} object that
295 * will generate the content for this {@code SOAPMessage}
296 * object
|