1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */

17
18 package org.apache.coyote;
19
20 /**
21  * ActionCodes represent callbacks from the servlet container to the coyote
22  * connector. Actions are implemented by ProtocolHandler, using the ActionHook
23  * interface.
24  *
25  * @see ProtocolHandler
26  * @see ActionHook
27  * @author Remy Maucherat
28  */

29 public enum ActionCode {
30     ACK,
31     CLOSE,
32     COMMIT,
33
34     /**
35      * A serious error occurred from which it is not possible to recover safely.
36      * Further attempts to write to the response should be ignored and the
37      * connection needs to be closed as soon as possible. This can also be used
38      * to forcibly close a connection if an error occurs after the response has
39      * been committed.
40      */

41     CLOSE_NOW,
42
43     /**
44      * A flush() operation originated by the client ( i.e. a flush() on the
45      * servlet output stream or writer, called by a servlet ). Argument is the
46      * Response.
47      */

48     CLIENT_FLUSH,
49
50     /**
51      * Has the processor been placed into the error state? Note that the
52      * response may not have an appropriate error code set.
53      */

54     IS_ERROR,
55
56     /**
57      * The processor may have been placed into an error state and some error
58      * states do not permit any further I/O. Is I/O currently allowed?
59      */

60     IS_IO_ALLOWED,
61
62     /**
63      * Hook called if swallowing request input should be disabled.
64      * Example: Cancel a large file upload.
65      *
66      */

67     DISABLE_SWALLOW_INPUT,
68
69     /**
70      * Callback for lazy evaluation - extract the remote host name and address.
71      */

72     REQ_HOST_ATTRIBUTE,
73
74     /**
75      * Callback for lazy evaluation - extract the remote host address.
76      */

77     REQ_HOST_ADDR_ATTRIBUTE,
78
79     /**
80      * Callback for lazy evaluation - extract the SSL-related attributes
81      * including the client certificate if present.
82      */

83     REQ_SSL_ATTRIBUTE,
84
85     /**
86      * Force a TLS re-handshake and make the resulting client certificate (if
87      * any) available as a request attribute.
88      */

89     REQ_SSL_CERTIFICATE,
90
91     /**
92      * Callback for lazy evaluation - socket remote port.
93      */

94     REQ_REMOTEPORT_ATTRIBUTE,
95
96     /**
97      * Callback for lazy evaluation - socket local port.
98      */

99     REQ_LOCALPORT_ATTRIBUTE,
100
101     /**
102      * Callback for lazy evaluation - local address.
103      */

104     REQ_LOCAL_ADDR_ATTRIBUTE,
105
106     /**
107      * Callback for lazy evaluation - local address.
108      */

109     REQ_LOCAL_NAME_ATTRIBUTE,
110
111     /**
112      * Callback for setting FORM auth body replay
113      */

114     REQ_SET_BODY_REPLAY,
115
116     /**
117      * Callback for getting the amount of available bytes.
118      */

119     AVAILABLE,
120
121     /**
122      * Callback for an async request.
123      */

124     ASYNC_START,
125
126     /**
127      * Callback for an async call to
128      * {@link javax.servlet.AsyncContext#dispatch()}.
129      */

130     ASYNC_DISPATCH,
131
132     /**
133      * Callback to indicate the the actual dispatch has started and that the
134      * async state needs change.
135      */

136     ASYNC_DISPATCHED,
137
138     /**
139      * Callback for an async call to
140      * {@link javax.servlet.AsyncContext#start(Runnable)}.
141      */

142     ASYNC_RUN,
143
144     /**
145      * Callback for an async call to
146      * {@link javax.servlet.AsyncContext#complete()}.
147      */

148     ASYNC_COMPLETE,
149
150     /**
151      * Callback to trigger the processing of an async timeout.
152      */

153     ASYNC_TIMEOUT,
154
155     /**
156      * Callback to trigger the error processing.
157      */

158     ASYNC_ERROR,
159
160     /**
161      * Callback for an async call to
162      * {@link javax.servlet.AsyncContext#setTimeout(long)}
163      */

164     ASYNC_SETTIMEOUT,
165
166     /**
167      * Callback to determine if async processing is in progress.
168      */

169     ASYNC_IS_ASYNC,
170
171     /**
172      * Callback to determine if async dispatch is in progress.
173      */

174     ASYNC_IS_STARTED,
175
176     /**
177      * Call back to determine if async complete is in progress.
178      */

179     ASYNC_IS_COMPLETING,
180
181     /**
182      * Callback to determine if async dispatch is in progress.
183      */

184     ASYNC_IS_DISPATCHING,
185
186     /**
187      * Callback to determine if async is timing out.
188      */

189     ASYNC_IS_TIMINGOUT,
190
191     /**
192     * Callback to determine if async is in error.
193     */

194     ASYNC_IS_ERROR,
195
196     /**
197      * Callback to trigger post processing. Typically only used during error
198      * handling to trigger essential processing that otherwise would be skipped.
199      */

200     ASYNC_POST_PROCESS,
201
202     /**
203      * Callback to trigger the HTTP upgrade process.
204      */

205     UPGRADE,
206
207     /**
208      * Indicator that Servlet is interested in being
209      * notified when data is available to be read.
210      */

211     NB_READ_INTEREST,
212
213     /**
214      * Used with non-blocking writes to determine if a write is currently
215      * allowed (sets passed parameter to <code>true</code>) or not (sets passed
216      * parameter to <code>false</code>). If a write is not allowed then callback
217      * will be triggered at some future point when write becomes possible again.
218      */

219     NB_WRITE_INTEREST,
220
221     /**
222      * Indicates if the request body has been fully read.
223      */

224     REQUEST_BODY_FULLY_READ,
225
226     /**
227      * Indicates that the container needs to trigger a call to onDataAvailable()
228      * for the registered non-blocking read listener.
229      */

230     DISPATCH_READ,
231
232     /**
233      * Indicates that the container needs to trigger a call to onWritePossible()
234      * for the registered non-blocking write listener.
235      */

236     DISPATCH_WRITE,
237
238     /**
239      * Execute any non-blocking dispatches that have been registered via
240      * {@link #DISPATCH_READ} or {@link #DISPATCH_WRITE}. Typically required
241      * when the non-blocking listeners are configured on a thread where the
242      * processing wasn't triggered by a read or write event on the socket.
243      */

244     DISPATCH_EXECUTE,
245
246     /**
247      * Is server push supported and allowed for the current request?
248      */

249     IS_PUSH_SUPPORTED,
250
251     /**
252      * Push a request on behalf of the client of the current request.
253      */

254     PUSH_REQUEST,
255
256     /**
257      * Are the request trailer fields ready to be read? Note that this returns
258      * true if it is known that request trailer fields are not supported so an
259      * empty collection of trailers can then be read.
260      */

261     IS_TRAILER_FIELDS_READY,
262
263     /**
264      * Are HTTP trailer fields supported for the current response? Note that
265      * once an HTTP/1.1 response has been committed, it will no longer support
266      * trailer fields.
267      */

268     IS_TRAILER_FIELDS_SUPPORTED
269 }
270