View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4   //  ------------------------------------------------------------------------
5   //  All rights reserved. This program and the accompanying materials
6   //  are made available under the terms of the Eclipse Public License v1.0
7   //  and Apache License v2.0 which accompanies this distribution.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.spdy;
20  
21  import org.eclipse.jetty.spdy.api.SPDY;
22  
23  public class CompressionDictionary
24  {
25      private static final byte[] DICTIONARY_V2 = ("" +
26              "optionsgetheadpostputdeletetraceacceptaccept-charsetaccept-encodingaccept-" +
27              "languageauthorizationexpectfromhostif-modified-sinceif-matchif-none-matchi" +
28              "f-rangeif-unmodifiedsincemax-forwardsproxy-authorizationrangerefererteuser" +
29              "-agent10010120020120220320420520630030130230330430530630740040140240340440" +
30              "5406407408409410411412413414415416417500501502503504505accept-rangesageeta" +
31              "glocationproxy-authenticatepublicretry-afterservervarywarningwww-authentic" +
32              "ateallowcontent-basecontent-encodingcache-controlconnectiondatetrailertran" +
33              "sfer-encodingupgradeviawarningcontent-languagecontent-lengthcontent-locati" +
34              "oncontent-md5content-rangecontent-typeetagexpireslast-modifiedset-cookieMo" +
35              "ndayTuesdayWednesdayThursdayFridaySaturdaySundayJanFebMarAprMayJunJulAugSe" +
36              "pOctNovDecchunkedtext/htmlimage/pngimage/jpgimage/gifapplication/xmlapplic" +
37              "ation/xhtmltext/plainpublicmax-agecharset=iso-8859-1utf-8gzipdeflateHTTP/1" +
38              ".1statusversionurl" +
39              // Must be NUL terminated
40              "\u0000").getBytes();
41  
42      private static final byte[] DICTIONARY_V3 = ("" +
43              "\u0000\u0000\u0000\u0007options\u0000\u0000\u0000\u0004head\u0000\u0000\u0000\u0004post" +
44              "\u0000\u0000\u0000\u0003put\u0000\u0000\u0000\u0006delete\u0000\u0000\u0000\u0005trace" +
45              "\u0000\u0000\u0000\u0006accept\u0000\u0000\u0000\u000Eaccept-charset" +
46              "\u0000\u0000\u0000\u000Faccept-encoding\u0000\u0000\u0000\u000Faccept-language" +
47              "\u0000\u0000\u0000\raccept-ranges\u0000\u0000\u0000\u0003age\u0000\u0000\u0000\u0005allow" +
48              "\u0000\u0000\u0000\rauthorization\u0000\u0000\u0000\rcache-control" +
49              "\u0000\u0000\u0000\nconnection\u0000\u0000\u0000\fcontent-base\u0000\u0000\u0000\u0010content-encoding" +
50              "\u0000\u0000\u0000\u0010content-language\u0000\u0000\u0000\u000Econtent-length" +
51              "\u0000\u0000\u0000\u0010content-location\u0000\u0000\u0000\u000Bcontent-md5" +
52              "\u0000\u0000\u0000\rcontent-range\u0000\u0000\u0000\fcontent-type\u0000\u0000\u0000\u0004date" +
53              "\u0000\u0000\u0000\u0004etag\u0000\u0000\u0000\u0006expect\u0000\u0000\u0000\u0007expires" +
54              "\u0000\u0000\u0000\u0004from\u0000\u0000\u0000\u0004host\u0000\u0000\u0000\bif-match" +
55              "\u0000\u0000\u0000\u0011if-modified-since\u0000\u0000\u0000\rif-none-match\u0000\u0000\u0000\bif-range" +
56              "\u0000\u0000\u0000\u0013if-unmodified-since\u0000\u0000\u0000\rlast-modified" +
57              "\u0000\u0000\u0000\blocation\u0000\u0000\u0000\fmax-forwards\u0000\u0000\u0000\u0006pragma" +
58              "\u0000\u0000\u0000\u0012proxy-authenticate\u0000\u0000\u0000\u0013proxy-authorization" +
59              "\u0000\u0000\u0000\u0005range\u0000\u0000\u0000\u0007referer\u0000\u0000\u0000\u000Bretry-after" +
60              "\u0000\u0000\u0000\u0006server\u0000\u0000\u0000\u0002te\u0000\u0000\u0000\u0007trailer" +
61              "\u0000\u0000\u0000\u0011transfer-encoding\u0000\u0000\u0000\u0007upgrade\u0000\u0000\u0000\nuser-agent" +
62              "\u0000\u0000\u0000\u0004vary\u0000\u0000\u0000\u0003via\u0000\u0000\u0000\u0007warning" +
63              "\u0000\u0000\u0000\u0010www-authenticate\u0000\u0000\u0000\u0006method\u0000\u0000\u0000\u0003get" +
64              "\u0000\u0000\u0000\u0006status\u0000\u0000\u0000\u0006200 OK\u0000\u0000\u0000\u0007version" +
65              "\u0000\u0000\u0000\bHTTP/1.1\u0000\u0000\u0000\u0003url\u0000\u0000\u0000\u0006public" +
66              "\u0000\u0000\u0000\nset-cookie\u0000\u0000\u0000\nkeep-alive\u0000\u0000\u0000\u0006origin" +
67              "100101201202205206300302303304305306307402405406407408409410411412413414415416417502504505" +
68              "203 Non-Authoritative Information204 No Content301 Moved Permanently400 Bad Request401 Unauthorized" +
69              "403 Forbidden404 Not Found500 Internal Server Error501 Not Implemented503 Service Unavailable" +
70              "Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec 00:00:00 Mon, Tue, Wed, Thu, Fri, Sat, Sun, GMT" +
71              "chunked,text/html,image/png,image/jpg,image/gif,application/xml,application/xhtml+xml,text/plain," +
72              "text/javascript,publicprivatemax-age=gzip,deflate,sdchcharset=utf-8charset=iso-8859-1,utf-,*,enq=0.")
73              .getBytes();
74  
75      public static byte[] get(short version)
76      {
77          switch (version)
78          {
79              case SPDY.V2:
80                  return DICTIONARY_V2;
81              case SPDY.V3:
82                  return DICTIONARY_V3;
83              default:
84                  throw new IllegalStateException();
85          }
86      }
87  }