001: /*
002: * Copyright 1999-2004 The Apache Software Foundation
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.coyote.http11;
018:
019: /**
020: * Constants.
021: *
022: * @author Remy Maucherat
023: */
024: public final class Constants {
025:
026: // -------------------------------------------------------------- Constants
027:
028: /**
029: * Package name.
030: */
031: public static final String Package = "org.apache.coyote.http11";
032:
033: public static final int DEFAULT_CONNECTION_LINGER = -1;
034: public static final int DEFAULT_CONNECTION_TIMEOUT = 60000;
035: public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000;
036: public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0;
037: public static final boolean DEFAULT_TCP_NO_DELAY = true;
038:
039: /**
040: * Server string.
041: */
042: public static final String SERVER = "Apache-Coyote/1.1";
043:
044: /**
045: * CR.
046: */
047: public static final byte CR = (byte) '\r';
048:
049: /**
050: * LF.
051: */
052: public static final byte LF = (byte) '\n';
053:
054: /**
055: * SP.
056: */
057: public static final byte SP = (byte) ' ';
058:
059: /**
060: * HT.
061: */
062: public static final byte HT = (byte) '\t';
063:
064: /**
065: * COLON.
066: */
067: public static final byte COLON = (byte) ':';
068:
069: /**
070: * 'A'.
071: */
072: public static final byte A = (byte) 'A';
073:
074: /**
075: * 'a'.
076: */
077: public static final byte a = (byte) 'a';
078:
079: /**
080: * 'Z'.
081: */
082: public static final byte Z = (byte) 'Z';
083:
084: /**
085: * '?'.
086: */
087: public static final byte QUESTION = (byte) '?';
088:
089: /**
090: * Lower case offset.
091: */
092: public static final byte LC_OFFSET = A - a;
093:
094: /**
095: * Default HTTP header buffer size.
096: */
097: public static final int DEFAULT_HTTP_HEADER_BUFFER_SIZE = 48 * 1024;
098:
099: /**
100: * CRLF.
101: */
102: public static final String CRLF = "\r\n";
103:
104: /**
105: * CRLF bytes.
106: */
107: public static final byte[] CRLF_BYTES = { (byte) '\r', (byte) '\n' };
108:
109: /**
110: * Colon bytes.
111: */
112: public static final byte[] COLON_BYTES = { (byte) ':', (byte) ' ' };
113:
114: /**
115: * Close bytes.
116: */
117: public static final byte[] CLOSE_BYTES = { (byte) 'c', (byte) 'l',
118: (byte) 'o', (byte) 's', (byte) 'e' };
119:
120: /**
121: * Keep-alive bytes.
122: */
123: public static final byte[] KEEPALIVE_BYTES = { (byte) 'k',
124: (byte) 'e', (byte) 'e', (byte) 'p', (byte) '-', (byte) 'a',
125: (byte) 'l', (byte) 'i', (byte) 'v', (byte) 'e' };
126:
127: /**
128: * Identity filters (input and output).
129: */
130: public static final int IDENTITY_FILTER = 0;
131:
132: /**
133: * Chunked filters (input and output).
134: */
135: public static final int CHUNKED_FILTER = 1;
136:
137: /**
138: * Void filters (input and output).
139: */
140: public static final int VOID_FILTER = 2;
141:
142: /**
143: * GZIP filter (output).
144: */
145: public static final int GZIP_FILTER = 3;
146:
147: /**
148: * Buffered filter (input)
149: */
150: public static final int BUFFERED_FILTER = 3;
151:
152: /**
153: * HTTP/1.0.
154: */
155: public static final String HTTP_10 = "HTTP/1.0";
156:
157: /**
158: * HTTP/1.1.
159: */
160: public static final String HTTP_11 = "HTTP/1.1";
161:
162: /**
163: * GET.
164: */
165: public static final String GET = "GET";
166:
167: /**
168: * HEAD.
169: */
170: public static final String HEAD = "HEAD";
171:
172: /**
173: * POST.
174: */
175: public static final String POST = "POST";
176:
177: /**
178: * Ack string when pipelining HTTP requests.
179: */
180: public static final byte[] ACK_BYTES = { (byte) 'H', (byte) 'T',
181: (byte) 'T', (byte) 'P', (byte) '/', (byte) '1', (byte) '.',
182: (byte) '1', (byte) ' ', (byte) '1', (byte) '0', (byte) '0',
183: (byte) ' ', (byte) 'C', (byte) 'o', (byte) 'n', (byte) 't',
184: (byte) 'i', (byte) 'n', (byte) 'u', (byte) 'e',
185: (byte) '\r', (byte) '\n', (byte) '\r', (byte) '\n' };
186:
187: }
|