01: // ========================================================================
02: // Copyright 2004-2005 Mort Bay Consulting Pty. Ltd.
03: // ------------------------------------------------------------------------
04: // Licensed under the Apache License, Version 2.0 (the "License");
05: // you may not use this file except in compliance with the License.
06: // You may obtain a copy of the License at
07: // http://www.apache.org/licenses/LICENSE-2.0
08: // Unless required by applicable law or agreed to in writing, software
09: // distributed under the License is distributed on an "AS IS" BASIS,
10: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11: // See the License for the specific language governing permissions and
12: // limitations under the License.
13: // ========================================================================
14:
15: package org.mortbay.jetty;
16:
17: import org.mortbay.io.Buffer;
18: import org.mortbay.io.BufferCache;
19:
20: /**
21: *
22: * @author gregw
23: */
24: public class HttpHeaderValues extends BufferCache {
25: public final static String CLOSE = "close", CHUNKED = "chunked",
26: GZIP = "gzip", IDENTITY = "identity",
27: KEEP_ALIVE = "keep-alive", CONTINUE = "100-continue",
28: PROCESSING = "102-processing";
29:
30: public final static int CLOSE_ORDINAL = 1, CHUNKED_ORDINAL = 2,
31: GZIP_ORDINAL = 3, IDENTITY_ORDINAL = 4,
32: KEEP_ALIVE_ORDINAL = 5, CONTINUE_ORDINAL = 6,
33: PROCESSING_ORDINAL = 7;
34:
35: public final static HttpHeaderValues CACHE = new HttpHeaderValues();
36:
37: public final static Buffer CLOSE_BUFFER = CACHE.add(CLOSE,
38: CLOSE_ORDINAL), CHUNKED_BUFFER = CACHE.add(CHUNKED,
39: CHUNKED_ORDINAL), GZIP_BUFFER = CACHE.add(GZIP,
40: GZIP_ORDINAL), IDENTITY_BUFFER = CACHE.add(IDENTITY,
41: IDENTITY_ORDINAL), KEEP_ALIVE_BUFFER = CACHE.add(
42: KEEP_ALIVE, KEEP_ALIVE_ORDINAL), CONTINUE_BUFFER = CACHE
43: .add(CONTINUE, CONTINUE_ORDINAL), PROCESSING_BUFFER = CACHE
44: .add(PROCESSING, PROCESSING_ORDINAL);
45:
46: static {
47: int index = 100;
48: CACHE.add("gzip", index++);
49: CACHE.add("gzip,deflate", index++);
50: CACHE.add("deflate", index++);
51: CACHE
52: .add(
53: "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)",
54: index++);
55: CACHE
56: .add(
57: "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",
58: index++);
59: CACHE
60: .add(
61: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7",
62: index++);
63: CACHE
64: .add(
65: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
66: index++);
67: CACHE
68: .add(
69: "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)",
70: index++);
71: CACHE.add("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
72: index++);
73: CACHE
74: .add(
75: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0",
76: index++);
77: CACHE.add("msnbot/1.0 (+http://search.msn.com/msnbot.htm)",
78: index++);
79: }
80: }
|