/// <summary>Creates an instance using the specified parameters</summary>
 /// <param name="mode">
 /// the mode to use, may be
 /// <code>null</code>
 /// , in which case
 /// <see cref="HttpMultipartMode.Strict">HttpMultipartMode.Strict</see>
 /// is used
 /// </param>
 /// <param name="boundary">
 /// the boundary string, may be
 /// <code>null</code>
 /// , in which case
 /// <see cref="GenerateBoundary()">GenerateBoundary()</see>
 /// is invoked to create the string
 /// </param>
 /// <param name="charset">
 /// the character set to use, may be
 /// <code>null</code>
 /// , in which case
 /// <see cref="MIME.DefaultCharset">MIME.DefaultCharset</see>
 /// - i.e. US-ASCII - is used.
 /// </param>
 public MultipartEntity(HttpMultipartMode mode, string boundary, Encoding charset)
     : base()
 {
     // @GuardedBy("dirty") // we always read dirty before accessing length
     // used to decide whether to recalculate length
     if (boundary == null)
     {
         boundary = GenerateBoundary();
     }
     if (mode == null)
     {
         mode = HttpMultipartMode.Strict;
     }
     this.multipart   = new HttpMultipart("related", charset, boundary, mode);
     this.contentType = new BasicHeader(HTTP.ContentType, GenerateContentType(boundary
                                                                              , charset));
     this.dirty = true;
 }
Пример #2
0
		/// <summary>Creates an instance using the specified parameters</summary>
		/// <param name="mode">
		/// the mode to use, may be
		/// <code>null</code>
		/// , in which case
		/// <see cref="HttpMultipartMode.Strict">HttpMultipartMode.Strict</see>
		/// is used
		/// </param>
		/// <param name="boundary">
		/// the boundary string, may be
		/// <code>null</code>
		/// , in which case
		/// <see cref="GenerateBoundary()">GenerateBoundary()</see>
		/// is invoked to create the string
		/// </param>
		/// <param name="charset">
		/// the character set to use, may be
		/// <code>null</code>
		/// , in which case
		/// <see cref="MIME.DefaultCharset">MIME.DefaultCharset</see>
		/// - i.e. US-ASCII - is used.
		/// </param>
		public MultipartEntity(HttpMultipartMode mode, string boundary, Encoding charset)
			 : base()
		{
			// @GuardedBy("dirty") // we always read dirty before accessing length
			// used to decide whether to recalculate length
			if (boundary == null)
			{
				boundary = GenerateBoundary();
			}
			if (mode == null)
			{
				mode = HttpMultipartMode.Strict;
			}
			this.multipart = new HttpMultipart("related", charset, boundary, mode);
			this.contentType = new BasicHeader(HTTP.ContentType, GenerateContentType(boundary
				, charset));
			this.dirty = true;
		}