1 23 38 39 package com.sun.enterprise.web.connector.grizzly; 40 41 import org.apache.tomcat.util.buf.ByteChunk; 42 43 48 public final class Constants { 49 50 51 54 public static final String Package = 55 "com.sun.enterprise.web.connector.grizzly"; 56 57 public static final int DEFAULT_CONNECTION_LINGER = -1; 58 public static int DEFAULT_CONNECTION_TIMEOUT = 60000; 59 public static final int DEFAULT_CONNECTION_UPLOAD_TIMEOUT = 300000; 60 public static final int DEFAULT_SERVER_SOCKET_TIMEOUT = 0; 61 public static final boolean DEFAULT_TCP_NO_DELAY = true; 62 63 66 public final static int DEFAULT_TIMEOUT = 30; 67 68 69 72 public final static int DEFAULT_REQUEST_BUFFER_SIZE = 4096; 73 74 75 78 public final static int DEFAULT_HEADER_SIZE = 8 * 1024; 79 80 81 84 public final static boolean DEFAULT_RECYCLE = true; 85 86 87 90 public final static int DEFAULT_MAX_KEEP_ALIVE = 256; 91 92 93 96 public final static int DEFAULT_QUEUE_SIZE = 4096; 97 98 99 103 public static int CHANNEL_BYTE_SIZE = 4098; 104 105 106 private static final String NIO_BUFFER_SIZE = 107 "com.sun.enterprise.web.connector.grizzly.buffersize"; 108 109 private static final String SOCKET_SO_TIMEOUT= 110 "com.sun.enterprise.web.connector.grizzly.socketSoTimeout"; 111 112 static{ 113 String tmp = System.getProperty(NIO_BUFFER_SIZE); 114 115 if ( tmp != null){ 116 try { 117 CHANNEL_BYTE_SIZE = Integer.parseInt(tmp); 118 } catch (NumberFormatException ex) { 119 ; 120 } 121 } 122 123 tmp = System.getProperty(SOCKET_SO_TIMEOUT); 124 if ( tmp != null){ 125 try { 126 DEFAULT_CONNECTION_TIMEOUT = Integer.parseInt(tmp); 127 } catch (NumberFormatException ex) { 128 ; 129 } 130 } 131 } 132 133 134 136 139 public static final String CRLF = "\r\n"; 140 141 142 145 public static final byte CR = (byte) '\r'; 146 147 148 151 public static final byte LF = (byte) '\n'; 152 153 154 157 public static final byte SP = (byte) ' '; 158 159 160 163 public static final byte HT = (byte) '\t'; 164 165 166 169 public static final byte COLON = (byte) ':'; 170 171 172 175 public static final byte A = (byte) 'A'; 176 177 178 181 public static final byte a = (byte) 'a'; 182 183 184 187 public static final byte Z = (byte) 'Z'; 188 189 190 193 public static final byte QUESTION = (byte) '?'; 194 195 196 199 public static final byte LC_OFFSET = A - a; 200 201 202 205 public static final int DEFAULT_HTTP_HEADER_BUFFER_SIZE = 48 * 1024; 206 207 208 209 public static final byte[] CRLF_BYTES = ByteChunk.convertToBytes(CRLF); 210 public static final byte[] COLON_BYTES = ByteChunk.convertToBytes(": "); 211 public static final String CONNECTION = "Connection"; 212 public static final String CLOSE = "close"; 213 public static final byte[] CLOSE_BYTES = 214 ByteChunk.convertToBytes(CLOSE); 215 public static final String KEEPALIVE = "keep-alive"; 216 public static final byte[] KEEPALIVE_BYTES = 217 ByteChunk.convertToBytes(KEEPALIVE); 218 public static final String CHUNKED = "chunked"; 219 public static final byte[] ACK_BYTES = 220 ByteChunk.convertToBytes("HTTP/1.1 100 Continue" + CRLF + CRLF); 221 public static final String TRANSFERENCODING = "Transfer-Encoding"; 222 public static final byte[] _200_BYTES = 223 ByteChunk.convertToBytes("200"); 224 public static final byte[] _400_BYTES = 225 ByteChunk.convertToBytes("400"); 226 public static final byte[] _404_BYTES = 227 ByteChunk.convertToBytes("404"); 228 229 230 233 public static final int IDENTITY_FILTER = 0; 234 235 236 239 public static final int CHUNKED_FILTER = 1; 240 241 242 245 public static final int VOID_FILTER = 2; 246 247 248 251 public static final int GZIP_FILTER = 3; 252 253 254 257 public static final int BUFFERED_FILTER = 3; 258 259 260 263 public static final String HTTP_10 = "HTTP/1.0"; 264 265 266 269 public static final String HTTP_11 = "HTTP/1.1"; 270 public static final byte[] HTTP_11_BYTES = 271 ByteChunk.convertToBytes(HTTP_11); 272 273 274 277 public static final String GET = "GET"; 278 279 280 283 public static final String HEAD = "HEAD"; 284 285 286 289 public static final String POST = "POST"; 290 291 } 292 | Popular Tags |