2
* $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/Header.java,v 1.10.2.3 2004/02/22 18:21:13 olegk Exp $
3
* $Revision: 1.10.2.3 $
4
* $Date: 2004/02/22 18:21:13 $
6
* ====================================================================
8
* Copyright 1999-2004 The Apache Software Foundation
10
* Licensed under the Apache License, Version 2.0 (the "License");
11
* you may not use this file except in compliance with the License.
12
* You may obtain a copy of the License at
14
* http://www.apache.org/licenses/LICENSE-2.0
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS,
18
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
* ====================================================================
23
* This software consists of voluntary contributions made by many
24
* individuals on behalf of the Apache Software Foundation. For more
25
* information on the Apache Software Foundation, please see
26
* <http://www.apache.org/>.
28
* [Additional notices, if required by prior licensing conditions]
32
package org.apache.commons.httpclient;
35
* <p>An HTTP header.</p>
37
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
38
* @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
39
* @version $Revision: 1.10.2.3 $ $Date: 2004/02/22 18:21:13 $
41
public class Header extends NameValuePair {
43
// ----------------------------------------------------------- Constructors
46
* Default constructor.
53
* Constructor with name and value
55
* @param name the header name
56
* @param value the header value
58
public Header(String name, String value) {
62
// --------------------------------------------------------- Public Methods
65
* Returns a {@link String} representation of the header in the form:
69
* The string is terminated by CRLF.
73
public String toExternalForm() {
74
return ((null == getName() ? "" : getName())
76
+ (null == getValue() ? "" : getValue())
81
* Returns a {@link String} representation of the header.
85
public String toString() {
86
return toExternalForm();
90
* Returns an array of {@link HeaderElement}s
91
* constructed from my value.
93
* @see HeaderElement#parse
94
* @throws HttpException if the header cannot be parsed
95
* @return an array of header elements
97
public HeaderElement[] getValues() throws HttpException {
98
return HeaderElement.parse(getValue());