/** * Allows to explicitly set the value and the MIME type of the body part * entity. This method doesn't have to be invoked if one of the non-default * constructors was already called. * <p/> * Either this method or {@link StreamDataBodyPart#setStreamEntity(InputStream)} * <strong>must</strong> be invoked if the default constructor was called. * * @param streamEntity entity to be set as a body part. * @param mediaType MIME type of the {@code streamEntity} attachment. */ public void setStreamEntity(final InputStream streamEntity, MediaType mediaType) { if (streamEntity == null) { throw new IllegalArgumentException("Stream body part entity cannot be null."); } if (mediaType == null) { mediaType = getDefaultMediaType(); } this.streamEntity = streamEntity; // Be sure to hit the parent (non-overloaded) method. super.setMediaType(mediaType); super.setEntity(streamEntity); setFormDataContentDisposition(buildContentDisposition()); }
/** * Allows to explicitly set the value and the MIME type of the body part * entity. This method doesn't have to be invoked if one of the non-default * constructors was already called. * <p/> * Either this method or {@link StreamDataBodyPart#setStreamEntity(InputStream)} * <strong>must</strong> be invoked if the default constructor was called. * * @param streamEntity entity to be set as a body part. * @param mediaType MIME type of the {@code streamEntity} attachment. */ public void setStreamEntity(final InputStream streamEntity, MediaType mediaType) { if (streamEntity == null) { throw new IllegalArgumentException("Stream body part entity cannot be null."); } if (mediaType == null) { mediaType = getDefaultMediaType(); } this.streamEntity = streamEntity; // Be sure to hit the parent (non-overloaded) method. super.setMediaType(mediaType); super.setEntity(streamEntity); setFormDataContentDisposition(buildContentDisposition()); }
/** * Allows to explicitly set the value and the MIME type of the body part * entity. This method doesn't have to be invoked if one of the non-default * constructors was already called. * <p/> * Either this method or {@link StreamDataBodyPart#setStreamEntity(InputStream)} * <strong>must</strong> be invoked if the default constructor was called. * * @param streamEntity entity to be set as a body part. * @param mediaType MIME type of the {@code streamEntity} attachment. */ public void setStreamEntity(final InputStream streamEntity, MediaType mediaType) { if (streamEntity == null) { throw new IllegalArgumentException("Stream body part entity cannot be null."); } if (mediaType == null) { mediaType = getDefaultMediaType(); } this.streamEntity = streamEntity; // Be sure to hit the parent (non-overloaded) method. super.setMediaType(mediaType); super.setEntity(streamEntity); setFormDataContentDisposition(buildContentDisposition()); }
/** * Allows to explicitly set the value and the MIME type of the body part * entity. This method doesn't have to be invoked if one of the non-default * constructors was already called. * <p/> * Either this method or {@link StreamDataBodyPart#setStreamEntity(InputStream)} * <strong>must</strong> be invoked if the default constructor was called. * * @param streamEntity entity to be set as a body part. * @param mediaType MIME type of the {@code streamEntity} attachment. */ public void setStreamEntity(final InputStream streamEntity, MediaType mediaType) { if (streamEntity == null) { throw new IllegalArgumentException("Stream body part entity cannot be null."); } if (mediaType == null) { mediaType = getDefaultMediaType(); } this.streamEntity = streamEntity; // Be sure to hit the parent (non-overloaded) method. super.setMediaType(mediaType); super.setEntity(streamEntity); setFormDataContentDisposition(buildContentDisposition()); }
/** * Allows to explicitly set the value and the MIME type of the body part * entity. This method doesn't have to be invoked if one of the non-default * constructors was already called. * <p/> * Either this method or {@link StreamDataBodyPart#setStreamEntity(InputStream)} * <strong>must</strong> be invoked if the default constructor was called. * * @param streamEntity entity to be set as a body part. * @param mediaType MIME type of the {@code streamEntity} attachment. */ public void setStreamEntity(final InputStream streamEntity, MediaType mediaType) { if (streamEntity == null) { throw new IllegalArgumentException("Stream body part entity cannot be null."); } if (mediaType == null) { mediaType = getDefaultMediaType(); } this.streamEntity = streamEntity; // Be sure to hit the parent (non-overloaded) method. super.setMediaType(mediaType); super.setEntity(streamEntity); setFormDataContentDisposition(buildContentDisposition()); }