|
1 /* |
|
2 * ==================================================================== |
|
3 * Licensed to the Apache Software Foundation (ASF) under one |
|
4 * or more contributor license agreements. See the NOTICE file |
|
5 * distributed with this work for additional information |
|
6 * regarding copyright ownership. The ASF licenses this file |
|
7 * to you under the Apache License, Version 2.0 (the |
|
8 * "License"); you may not use this file except in compliance |
|
9 * with the License. You may obtain a copy of the License at |
|
10 * |
|
11 * http://www.apache.org/licenses/LICENSE-2.0 |
|
12 * |
|
13 * Unless required by applicable law or agreed to in writing, |
|
14 * software distributed under the License is distributed on an |
|
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
16 * KIND, either express or implied. See the License for the |
|
17 * specific language governing permissions and limitations |
|
18 * under the License. |
|
19 * ==================================================================== |
|
20 * |
|
21 * This software consists of voluntary contributions made by many |
|
22 * individuals on behalf of the Apache Software Foundation. For more |
|
23 * information on the Apache Software Foundation, please see |
|
24 * <http://www.apache.org/>. |
|
25 * |
|
26 */ |
|
27 |
|
28 package ch.boye.httpclientandroidlib.protocol; |
|
29 |
|
30 /** |
|
31 * Constants and static helpers related to the HTTP protocol. |
|
32 * |
|
33 * @since 4.0 |
|
34 */ |
|
35 public final class HTTP { |
|
36 |
|
37 public static final int CR = 13; // <US-ASCII CR, carriage return (13)> |
|
38 public static final int LF = 10; // <US-ASCII LF, linefeed (10)> |
|
39 public static final int SP = 32; // <US-ASCII SP, space (32)> |
|
40 public static final int HT = 9; // <US-ASCII HT, horizontal-tab (9)> |
|
41 |
|
42 /** HTTP header definitions */ |
|
43 public static final String TRANSFER_ENCODING = "Transfer-Encoding"; |
|
44 public static final String CONTENT_LEN = "Content-Length"; |
|
45 public static final String CONTENT_TYPE = "Content-Type"; |
|
46 public static final String CONTENT_ENCODING = "Content-Encoding"; |
|
47 public static final String EXPECT_DIRECTIVE = "Expect"; |
|
48 public static final String CONN_DIRECTIVE = "Connection"; |
|
49 public static final String TARGET_HOST = "Host"; |
|
50 public static final String USER_AGENT = "User-Agent"; |
|
51 public static final String DATE_HEADER = "Date"; |
|
52 public static final String SERVER_HEADER = "Server"; |
|
53 |
|
54 /** HTTP expectations */ |
|
55 public static final String EXPECT_CONTINUE = "100-continue"; |
|
56 |
|
57 /** HTTP connection control */ |
|
58 public static final String CONN_CLOSE = "Close"; |
|
59 public static final String CONN_KEEP_ALIVE = "Keep-Alive"; |
|
60 |
|
61 /** Transfer encoding definitions */ |
|
62 public static final String CHUNK_CODING = "chunked"; |
|
63 public static final String IDENTITY_CODING = "identity"; |
|
64 |
|
65 /** Common charset definitions */ |
|
66 public static final String UTF_8 = "UTF-8"; |
|
67 public static final String UTF_16 = "UTF-16"; |
|
68 public static final String US_ASCII = "US-ASCII"; |
|
69 public static final String ASCII = "ASCII"; |
|
70 public static final String ISO_8859_1 = "ISO-8859-1"; |
|
71 |
|
72 /** Default charsets */ |
|
73 public static final String DEFAULT_CONTENT_CHARSET = ISO_8859_1; |
|
74 public static final String DEFAULT_PROTOCOL_CHARSET = US_ASCII; |
|
75 |
|
76 /** Content type definitions */ |
|
77 public final static String OCTET_STREAM_TYPE = "application/octet-stream"; |
|
78 public final static String PLAIN_TEXT_TYPE = "text/plain"; |
|
79 public final static String CHARSET_PARAM = "; charset="; |
|
80 |
|
81 /** Default content type */ |
|
82 public final static String DEFAULT_CONTENT_TYPE = OCTET_STREAM_TYPE; |
|
83 |
|
84 public static boolean isWhitespace(char ch) { |
|
85 return ch == SP || ch == HT || ch == CR || ch == LF; |
|
86 } |
|
87 |
|
88 private HTTP() { |
|
89 } |
|
90 |
|
91 } |