Provides functionality and attributes common to all supported protocols (currently HTTP and AJP) for processing a single request/response.
| 45 | * single request/response. |
| 46 | */ |
| 47 | public abstract class AbstractProcessor extends AbstractProcessorLight implements ActionHook { |
| 48 | |
| 49 | /** The string manager for this class. */ |
| 50 | private static final StringManager sm = StringManager.getManager(AbstractProcessor.class); |
| 51 | |
| 52 | /** Used to avoid useless B2C conversion on the host name. */ |
| 53 | private char[] hostNameC = new char[0]; |
| 54 | |
| 55 | /** The adapter for this processor. */ |
| 56 | protected final Adapter adapter; |
| 57 | /** State machine for async processing. */ |
| 58 | protected final AsyncStateMachine asyncStateMachine; |
| 59 | private volatile long asyncTimeout = -1; |
| 60 | /* |
| 61 | * Tracks the current async generation when a timeout is dispatched. In the time it takes for a container thread to |
| 62 | * be allocated and the timeout processing to start, it is possible that the application completes this generation |
| 63 | * of async processing and starts a new one. If the timeout is then processed against the new generation, response |
| 64 | * mix-up can occur. This field is used to ensure that any timeout event processed is for the current async |
| 65 | * generation. This prevents the response mix-up. |
| 66 | */ |
| 67 | private volatile long asyncTimeoutGeneration = 0; |
| 68 | /** The request being processed. */ |
| 69 | protected final Request request; |
| 70 | /** The response being processed. */ |
| 71 | protected final Response response; |
| 72 | /** The socket wrapper for this processor. */ |
| 73 | protected volatile SocketWrapperBase<?> socketWrapper = null; |
| 74 | /** SSL support for this connection. */ |
| 75 | protected volatile SSLSupport sslSupport; |
| 76 | |
| 77 | |
| 78 | /** |
| 79 | * Error state for the request/response currently being processed. |
| 80 | */ |
| 81 | private ErrorState errorState = ErrorState.NONE; |
| 82 | |
| 83 | /** User data helper for logging. */ |
| 84 | protected final UserDataHelper userDataHelper; |
| 85 | |
| 86 | /** |
| 87 | * Creates a new processor with the given adapter. |
| 88 | * |
| 89 | * @param adapter The adapter for this processor |
| 90 | */ |
| 91 | public AbstractProcessor(Adapter adapter) { |
| 92 | this(adapter, new Request(), new Response()); |
| 93 | } |
| 94 | |
| 95 | |
| 96 | /** |
| 97 | * Constructs a new processor with the given adapter, request, and response. |
| 98 | * |
| 99 | * @param adapter The adapter for this processor |
| 100 | * @param coyoteRequest The coyote request |
| 101 | * @param coyoteResponse The coyote response |
| 102 | */ |
| 103 | protected AbstractProcessor(Adapter adapter, Request coyoteRequest, Response coyoteResponse) { |
| 104 | this.adapter = adapter; |
nothing calls this directly
no test coverage detected