KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > mime > ContentHeader


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  *
22  * $Id: ContentHeader.java,v 1.1 2004/04/21 19:31:58 slobodan Exp $
23  */

24
25
26
27
28 package com.lutris.mime;
29
30 /**
31  * Parses and represents Mime header fields that have the form of the
32  * <code>Content-Type</code> header as defined in RFC2045 Section 5.1
33  * Page 11. The format of these headers is informally:
34  * <PRE>
35  * <Header-Type>: <value> [ ; <parameter> ... ]
36  * </PRE>
37  * Examples:
38  * <PRE>
39  * Content-Type: application/octet-stream
40  * Content-Type: multipart/form-data; boundary="---123456"
41  * Content-Disposition: form-data; name=upload; filename="/tmp/myfile"
42  * </PRE>
43  * In addition to the actual header syntax, RFC822 header comments are
44  * allowed. Such comments consist of text enclosed in parentheses.
45  */

46 public class ContentHeader extends MimeHeader
47 {
48     /**
49      * Constructs a new ContentTypeHeader object from an unparsed Mime
50      * <code>Content-Type</code> header line. The header line should
51      * include the <i>entire</i> line as read from the input source.
52      *
53      * @param headerLine The entire line containing the Mime header.
54      */

55     public
56     ContentHeader(String JavaDoc headerLine)
57     {
58     super(headerLine);
59     int pos = headerLine.indexOf(';');
60     if (pos >= 0) parseParameters(headerLine.substring(pos+1));
61     }
62
63     /**
64      * Constructs a new ContentTypeHeader object from an existing
65      * <code>MimeHeader</code> object.
66      *
67      * @param hdr An existing <code>MimeHeader</code> object.
68      */

69     public
70     ContentHeader(MimeHeader hdr)
71     {
72     super(hdr.getRawHeaderLine());
73     String JavaDoc headerLine = hdr.getRawHeaderLine();
74     int pos = headerLine.indexOf(';');
75     if (pos >= 0) parseParameters(headerLine.substring(pos+1));
76     }
77 }
78
Popular Tags