This is a low-level, efficient representation of a server request. Most fields are GC-free, expensive operations are delayed until the user code needs the information. Processing is delegated to modules, using a hook mechanism. This class is not intended for user code - it is used internally by tomc
| 54 | * </ul> |
| 55 | */ |
| 56 | public final class Request { |
| 57 | |
| 58 | private static final StringManager sm = StringManager.getManager(Request.class); |
| 59 | |
| 60 | // Expected maximum typical number of cookies per request. |
| 61 | private static final int INITIAL_COOKIE_SIZE = 4; |
| 62 | |
| 63 | /* |
| 64 | * At 100,000 requests a second there are enough IDs here for ~3,000,000 years before it overflows (and then we have |
| 65 | * another 3,000,000 years before it gets back to zero). |
| 66 | * |
| 67 | * Local testing shows that 5, 10, 50, 500 or 1000 threads can obtain 60,000,000+ IDs a second from a single |
| 68 | * AtomicLong. That is about 17ns per request. It does not appear that the introduction of this counter will cause a |
| 69 | * bottleneck for request processing. |
| 70 | */ |
| 71 | private static final AtomicLong requestIdGenerator = new AtomicLong(0); |
| 72 | |
| 73 | // public static final int NOTE_ADAPTER = 1; // Defined in CoyoteAdapter |
| 74 | /** |
| 75 | * Note key for bad request. |
| 76 | */ |
| 77 | public static final int NOTE_BAD_REQUEST = 2; |
| 78 | |
| 79 | |
| 80 | // ----------------------------------------------------------- Constructors |
| 81 | |
| 82 | /** |
| 83 | * Default constructor. |
| 84 | */ |
| 85 | public Request() { |
| 86 | parameters.setQuery(queryMB); |
| 87 | parameters.setURLDecoder(urlDecoder); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | // ----------------------------------------------------- Instance Variables |
| 92 | |
| 93 | private int serverPort = -1; |
| 94 | private final MessageBytes serverNameMB = MessageBytes.newInstance(); |
| 95 | |
| 96 | private int remotePort; |
| 97 | private int localPort; |
| 98 | |
| 99 | private final MessageBytes schemeMB = MessageBytes.newInstance(); |
| 100 | |
| 101 | private final MessageBytes methodMB = MessageBytes.newInstance(); |
| 102 | private final MessageBytes uriMB = MessageBytes.newInstance(); |
| 103 | private final MessageBytes decodedUriMB = MessageBytes.newInstance(); |
| 104 | private final MessageBytes queryMB = MessageBytes.newInstance(); |
| 105 | private final MessageBytes protoMB = MessageBytes.newInstance(); |
| 106 | |
| 107 | private volatile String requestId = Long.toString(requestIdGenerator.getAndIncrement()); |
| 108 | |
| 109 | // remote address/host |
| 110 | private final MessageBytes remoteAddrMB = MessageBytes.newInstance(); |
| 111 | private final MessageBytes peerAddrMB = MessageBytes.newInstance(); |
| 112 | private final MessageBytes localNameMB = MessageBytes.newInstance(); |
| 113 | private final MessageBytes remoteHostMB = MessageBytes.newInstance(); |
nothing calls this directly
no test coverage detected