Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/lutris/mime/ContentHeader.java


1   /*
2    * Enhydra Java Application Server Project
3    * 
4    * The contents of this file are subject to the Enhydra Public License
5    * Version 1.1 (the "License"); you may not use this file except in
6    * compliance with the License. You may obtain a copy of the License on
7    * the Enhydra web site ( http://www.enhydra.org/ ).
8    * 
9    * Software distributed under the License is distributed on an "AS IS"
10   * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 
11   * the License for the specific terms governing rights and limitations
12   * under the License.
13   * 
14   * The Initial Developer of the Enhydra Application Server is Lutris
15   * Technologies, Inc. The Enhydra Application Server and portions created
16   * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17   * All Rights Reserved.
18   * 
19   * Contributor(s):
20   * 
21   * $Id: ContentHeader.java,v 1.7.12.1 2000/10/19 17:58:53 jasona Exp $
22   */
23  
24  
25  
26  
27  package com.lutris.mime;
28  
29  /**
30   * Parses and represents Mime header fields that have the form of the
31   * <code>Content-Type</code> header as defined in RFC2045 Section 5.1
32   * Page 11.  The format of these headers is informally:
33   * <PRE>
34   *   <Header-Type>: <value> [ ; <parameter> ... ]
35   * </PRE>
36   * Examples:
37   * <PRE>
38   *   Content-Type: application/octet-stream
39   *   Content-Type: multipart/form-data; boundary="---123456"
40   *   Content-Disposition: form-data; name=upload; filename="/tmp/myfile"
41   * </PRE>
42   * In addition to the actual header syntax, RFC822 header comments are
43   * allowed.  Such comments consist of text enclosed in parentheses.
44   */
45  public class ContentHeader extends MimeHeader 
46  {
47      /**
48       * Constructs a new ContentTypeHeader object from an unparsed Mime 
49       * <code>Content-Type</code> header line.  The header line should
50       * include the <i>entire</i> line as read from the input source.
51       * 
52       * @param  headerLine  The entire line containing the Mime header.
53       */
54      public
55      ContentHeader(String headerLine)
56      {
57    super(headerLine);
58    int pos = headerLine.indexOf(';');
59    if (pos >= 0) parseParameters(headerLine.substring(pos+1));
60      }
61  
62      /**
63       * Constructs a new ContentTypeHeader object from an existing
64       * <code>MimeHeader</code> object.
65       * 
66       * @param  hdr    An existing <code>MimeHeader</code> object.
67       */
68      public
69      ContentHeader(MimeHeader hdr)
70      {
71    super(hdr.getRawHeaderLine());
72    String headerLine = hdr.getRawHeaderLine();
73    int pos = headerLine.indexOf(';');
74    if (pos >= 0) parseParameters(headerLine.substring(pos+1));
75      }
76  }