Source code: org/apache/http/protocol/HTTP.java
1 /*
2 * $HeadURL: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/tags/4.0-alpha2/src/java/org/apache/http/protocol/HTTP.java $
3 * $Revision: 390703 $
4 * $Date: 2006-04-01 19:35:45 +0200 (Sat, 01 Apr 2006) $
5 *
6 * ====================================================================
7 *
8 * Copyright 1999-2006 The Apache Software Foundation
9 *
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
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
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 * ====================================================================
22 *
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/>.
27 *
28 */
29
30 package org.apache.http.protocol;
31
32 /**
33 * Constants and static helpers related to the HTTP protocol.
34 *
35 * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
36 *
37 * @version $Revision: 390703 $
38 *
39 * @since 4.0
40 */
41 public final class HTTP {
42
43 public static final int CR = 13; // <US-ASCII CR, carriage return (13)>
44 public static final int LF = 10; // <US-ASCII LF, linefeed (10)>
45 public static final int SP = 32; // <US-ASCII SP, space (32)>
46 public static final int HT = 9; // <US-ASCII HT, horizontal-tab (9)>
47
48 /** HTTP header definitions */
49 public static final String TRANSFER_ENCODING = "Transfer-Encoding";
50 public static final String CONTENT_LEN = "Content-Length";
51 public static final String CONTENT_TYPE = "Content-Type";
52 public static final String CONTENT_ENCODING = "Content-Encoding";
53 public static final String EXPECT_DIRECTIVE = "Expect";
54 public static final String CONN_DIRECTIVE = "Connection";
55 public static final String TARGET_HOST = "Host";
56 public static final String USER_AGENT = "User-Agent";
57 public static final String DATE_DIRECTIVE = "Date";
58 public static final String SERVER_DIRECTIVE = "Server";
59
60 /** HTTP expectations */
61 public static final String EXPECT_CONTINUE = "100-Continue";
62
63 /** HTTP connection control */
64 public static final String CONN_CLOSE = "Close";
65 public static final String CONN_KEEP_ALIVE = "Keep-Alive";
66
67 /** Transfer encoding definitions */
68 public static final String CHUNK_CODING = "chunked";
69 public static final String IDENTITY_CODING = "identity";
70
71 /** Common charset definitions */
72 public static final String UTF_8 = "UTF-8";
73 public static final String UTF_16 = "UTF-16";
74 public static final String US_ASCII = "US-ASCII";
75 public static final String ASCII = "ASCII";
76 public static final String ISO_8859_1 = "ISO-8859-1";
77
78 /** Default charsets */
79 public static final String DEFAULT_CONTENT_CHARSET = ISO_8859_1;
80 public static final String DEFAULT_PROTOCOL_CHARSET = US_ASCII;
81
82 /** Content type definitions */
83 public final static String OCTET_STREAM_TYPE = "application/octet-stream";
84 public final static String PLAIN_TEXT_TYPE = "text/plain";
85 public final static String CHARSET_PARAM = "; charset=";
86
87 /** Default content type */
88 public final static String DEFAULT_CONTENT_TYPE = OCTET_STREAM_TYPE;
89
90 public static boolean isWhitespace(char ch) {
91 return ch == SP || ch == HT || ch == CR || ch == LF;
92 }
93
94 private HTTP() {
95 }
96
97 }