Mercurial Hosting > luan
annotate src/org/eclipse/jetty/server/AsyncContinuation.java @ 917:1fc8ee20cb18
remove doSuspend
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 09 Oct 2016 03:23:55 -0600 |
parents | b9aa175d9a29 |
children | 7b62446899c6 |
rev | line source |
---|---|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
1 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
2 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
4 // ------------------------------------------------------------------------ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
5 // All rights reserved. This program and the accompanying materials |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
6 // are made available under the terms of the Eclipse Public License v1.0 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
7 // and Apache License v2.0 which accompanies this distribution. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
8 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
9 // The Eclipse Public License is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
10 // http://www.eclipse.org/legal/epl-v10.html |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
11 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
12 // The Apache License v2.0 is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
13 // http://www.opensource.org/licenses/apache2.0.php |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
14 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
15 // You may elect to redistribute this code under either of these licenses. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
16 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
17 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
18 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
19 package org.eclipse.jetty.server; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
20 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
21 import javax.servlet.AsyncContext; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
22 import javax.servlet.AsyncEvent; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
23 import javax.servlet.AsyncListener; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
24 import javax.servlet.RequestDispatcher; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 import javax.servlet.ServletException; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
26 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
27 import java.util.ArrayList; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 import java.util.List; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
29 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 import javax.servlet.ServletContext; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
31 import javax.servlet.ServletRequest; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
32 import javax.servlet.ServletResponse; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
33 import javax.servlet.http.HttpServletRequest; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
34 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
35 import org.eclipse.jetty.continuation.Continuation; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
36 import org.eclipse.jetty.continuation.ContinuationThrowable; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
37 import org.eclipse.jetty.continuation.ContinuationListener; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
38 import org.eclipse.jetty.io.AsyncEndPoint; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
39 import org.eclipse.jetty.io.EndPoint; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
40 import org.eclipse.jetty.server.handler.ContextHandler; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
41 import org.eclipse.jetty.server.handler.ContextHandler.Context; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
42 import org.eclipse.jetty.util.URIUtil; |
820
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
43 import org.slf4j.Logger; |
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
44 import org.slf4j.LoggerFactory; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
45 import org.eclipse.jetty.util.thread.Timeout; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
46 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
47 /* ------------------------------------------------------------ */ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
48 /** Implementation of Continuation and AsyncContext interfaces |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
49 * |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
50 */ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
51 public class AsyncContinuation implements AsyncContext, Continuation |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
52 { |
865 | 53 private static final Logger LOG = LoggerFactory.getLogger(AsyncContinuation.class); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
54 |
865 | 55 private final static long DEFAULT_TIMEOUT=30000L; |
56 | |
57 private final static ContinuationThrowable __exception = new ContinuationThrowable(); | |
58 | |
59 // STATES: | |
60 // handling() suspend() unhandle() resume() complete() doComplete() | |
61 // startAsync() dispatch() | |
62 // IDLE DISPATCHED | |
63 // DISPATCHED ASYNCSTARTED UNCOMPLETED | |
64 // ASYNCSTARTED ASYNCWAIT REDISPATCHING COMPLETING | |
65 // REDISPATCHING REDISPATCHED | |
66 // ASYNCWAIT REDISPATCH COMPLETING | |
67 // REDISPATCH REDISPATCHED | |
68 // REDISPATCHED ASYNCSTARTED UNCOMPLETED | |
69 // COMPLETING UNCOMPLETED UNCOMPLETED | |
70 // UNCOMPLETED COMPLETED | |
71 // COMPLETED | |
72 private static final int __IDLE=0; // Idle request | |
73 private static final int __DISPATCHED=1; // Request dispatched to filter/servlet | |
74 private static final int __ASYNCSTARTED=2; // Suspend called, but not yet returned to container | |
75 private static final int __REDISPATCHING=3;// resumed while dispatched | |
76 private static final int __ASYNCWAIT=4; // Suspended and parked | |
77 private static final int __REDISPATCH=5; // Has been scheduled | |
78 private static final int __REDISPATCHED=6; // Request redispatched to filter/servlet | |
79 private static final int __COMPLETING=7; // complete while dispatched | |
80 private static final int __UNCOMPLETED=8; // Request is completable | |
81 private static final int __COMPLETED=9; // Request is complete | |
82 | |
83 /* ------------------------------------------------------------ */ | |
84 protected AbstractHttpConnection _connection; | |
85 private List<AsyncListener> _lastAsyncListeners; | |
86 private List<AsyncListener> _asyncListeners; | |
87 private List<ContinuationListener> _continuationListeners; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
88 |
865 | 89 /* ------------------------------------------------------------ */ |
90 private int _state; | |
91 private boolean _initial; | |
92 private boolean _resumed; | |
93 private boolean _expired; | |
94 private volatile boolean _responseWrapped; | |
95 private long _timeoutMs=DEFAULT_TIMEOUT; | |
96 private AsyncEventState _event; | |
97 private volatile long _expireAt; | |
98 private volatile boolean _continuation; | |
99 | |
100 /* ------------------------------------------------------------ */ | |
101 protected AsyncContinuation() | |
102 { | |
103 _state=__IDLE; | |
104 _initial=true; | |
105 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
106 |
865 | 107 /* ------------------------------------------------------------ */ |
108 protected void setConnection(final AbstractHttpConnection connection) | |
109 { | |
110 synchronized(this) | |
111 { | |
112 _connection=connection; | |
113 } | |
114 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
115 |
865 | 116 /* ------------------------------------------------------------ */ |
117 public void addListener(AsyncListener listener) | |
118 { | |
119 synchronized(this) | |
120 { | |
121 if (_asyncListeners==null) | |
122 _asyncListeners=new ArrayList<AsyncListener>(); | |
123 _asyncListeners.add(listener); | |
124 } | |
125 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
126 |
865 | 127 /* ------------------------------------------------------------ */ |
128 public void addListener(AsyncListener listener,ServletRequest request, ServletResponse response) | |
129 { | |
130 synchronized(this) | |
131 { | |
132 // TODO handle the request/response ??? | |
133 if (_asyncListeners==null) | |
134 _asyncListeners=new ArrayList<AsyncListener>(); | |
135 _asyncListeners.add(listener); | |
136 } | |
137 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
138 |
865 | 139 /* ------------------------------------------------------------ */ |
140 public void addContinuationListener(ContinuationListener listener) | |
141 { | |
142 synchronized(this) | |
143 { | |
144 if (_continuationListeners==null) | |
145 _continuationListeners=new ArrayList<ContinuationListener>(); | |
146 _continuationListeners.add(listener); | |
147 } | |
148 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
149 |
865 | 150 /* ------------------------------------------------------------ */ |
151 public void setTimeout(long ms) | |
152 { | |
153 synchronized(this) | |
154 { | |
155 _timeoutMs=ms; | |
156 } | |
157 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
158 |
865 | 159 /* ------------------------------------------------------------ */ |
160 public long getTimeout() | |
161 { | |
162 synchronized(this) | |
163 { | |
164 return _timeoutMs; | |
165 } | |
166 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
167 |
865 | 168 /* ------------------------------------------------------------ */ |
169 public AsyncEventState getAsyncEventState() | |
170 { | |
171 synchronized(this) | |
172 { | |
173 return _event; | |
174 } | |
175 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
176 |
865 | 177 /* ------------------------------------------------------------ */ |
178 /** | |
179 * @see org.eclipse.jetty.continuation.Continuation#keepWrappers() | |
180 */ | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
181 |
865 | 182 /* ------------------------------------------------------------ */ |
183 /** | |
184 * @see org.eclipse.jetty.continuation.Continuation#isResponseWrapped() | |
185 */ | |
186 public boolean isResponseWrapped() | |
187 { | |
188 return _responseWrapped; | |
189 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
190 |
865 | 191 /* ------------------------------------------------------------ */ |
192 /* (non-Javadoc) | |
193 * @see javax.servlet.ServletRequest#isInitial() | |
194 */ | |
195 public boolean isInitial() | |
196 { | |
197 synchronized(this) | |
198 { | |
199 return _initial; | |
200 } | |
201 } | |
202 | |
203 public boolean isContinuation() | |
204 { | |
205 return _continuation; | |
206 } | |
207 | |
208 /* ------------------------------------------------------------ */ | |
209 /* (non-Javadoc) | |
210 * @see javax.servlet.ServletRequest#isSuspended() | |
211 */ | |
212 public boolean isSuspended() | |
213 { | |
214 synchronized(this) | |
215 { | |
216 switch(_state) | |
217 { | |
218 case __ASYNCSTARTED: | |
219 case __REDISPATCHING: | |
220 case __COMPLETING: | |
221 case __ASYNCWAIT: | |
222 return true; | |
223 | |
224 default: | |
225 return false; | |
226 } | |
227 } | |
228 } | |
229 | |
230 /* ------------------------------------------------------------ */ | |
231 public boolean isSuspending() | |
232 { | |
233 synchronized(this) | |
234 { | |
235 switch(_state) | |
236 { | |
237 case __ASYNCSTARTED: | |
238 case __ASYNCWAIT: | |
239 return true; | |
240 | |
241 default: | |
242 return false; | |
243 } | |
244 } | |
245 } | |
246 | |
247 /* ------------------------------------------------------------ */ | |
248 public boolean isDispatchable() | |
249 { | |
250 synchronized(this) | |
251 { | |
252 switch(_state) | |
253 { | |
254 case __REDISPATCH: | |
255 case __REDISPATCHED: | |
256 case __REDISPATCHING: | |
257 case __COMPLETING: | |
258 return true; | |
259 | |
260 default: | |
261 return false; | |
262 } | |
263 } | |
264 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
265 |
865 | 266 /* ------------------------------------------------------------ */ |
267 @Override | |
268 public String toString() | |
269 { | |
270 synchronized (this) | |
271 { | |
272 return super.toString()+"@"+getStatusString(); | |
273 } | |
274 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
275 |
865 | 276 /* ------------------------------------------------------------ */ |
277 public String getStatusString() | |
278 { | |
279 synchronized (this) | |
280 { | |
281 return | |
282 ((_state==__IDLE)?"IDLE": | |
283 (_state==__DISPATCHED)?"DISPATCHED": | |
284 (_state==__ASYNCSTARTED)?"ASYNCSTARTED": | |
285 (_state==__ASYNCWAIT)?"ASYNCWAIT": | |
286 (_state==__REDISPATCHING)?"REDISPATCHING": | |
287 (_state==__REDISPATCH)?"REDISPATCH": | |
288 (_state==__REDISPATCHED)?"REDISPATCHED": | |
289 (_state==__COMPLETING)?"COMPLETING": | |
290 (_state==__UNCOMPLETED)?"UNCOMPLETED": | |
291 (_state==__COMPLETED)?"COMPLETE": | |
292 ("UNKNOWN?"+_state))+ | |
293 (_initial?",initial":"")+ | |
294 (_resumed?",resumed":"")+ | |
295 (_expired?",expired":""); | |
296 } | |
297 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
298 |
865 | 299 /* ------------------------------------------------------------ */ |
300 /** | |
301 * @return false if the handling of the request should not proceed | |
302 */ | |
303 protected boolean handling() | |
304 { | |
305 synchronized (this) | |
306 { | |
307 _continuation=false; | |
308 | |
309 switch(_state) | |
310 { | |
311 case __IDLE: | |
312 _initial=true; | |
313 _state=__DISPATCHED; | |
314 if (_lastAsyncListeners!=null) | |
315 _lastAsyncListeners.clear(); | |
316 if (_asyncListeners!=null) | |
317 _asyncListeners.clear(); | |
318 else | |
319 { | |
320 _asyncListeners=_lastAsyncListeners; | |
321 _lastAsyncListeners=null; | |
322 } | |
323 return true; | |
324 | |
325 case __COMPLETING: | |
326 _state=__UNCOMPLETED; | |
327 return false; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
328 |
865 | 329 case __ASYNCWAIT: |
330 return false; | |
331 | |
332 case __REDISPATCH: | |
333 _state=__REDISPATCHED; | |
334 return true; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
335 |
865 | 336 default: |
337 throw new IllegalStateException(this.getStatusString()); | |
338 } | |
339 } | |
340 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
341 |
865 | 342 /* ------------------------------------------------------------ */ |
343 /** | |
344 * Signal that the HttpConnection has finished handling the request. | |
345 * For blocking connectors, this call may block if the request has | |
346 * been suspended (startAsync called). | |
347 * @return true if handling is complete, false if the request should | |
348 * be handled again (eg because of a resume that happened before unhandle was called) | |
349 */ | |
350 protected boolean unhandle() | |
351 { | |
352 synchronized (this) | |
353 { | |
354 switch(_state) | |
355 { | |
356 case __REDISPATCHED: | |
357 case __DISPATCHED: | |
358 _state=__UNCOMPLETED; | |
359 return true; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
360 |
865 | 361 case __IDLE: |
362 throw new IllegalStateException(this.getStatusString()); | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
363 |
865 | 364 case __ASYNCSTARTED: |
365 _initial=false; | |
366 _state=__ASYNCWAIT; | |
367 scheduleTimeout(); // could block and change state. | |
368 if (_state==__ASYNCWAIT) | |
369 return true; | |
370 else if (_state==__COMPLETING) | |
371 { | |
372 _state=__UNCOMPLETED; | |
373 return true; | |
374 } | |
375 _initial=false; | |
376 _state=__REDISPATCHED; | |
377 return false; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
378 |
865 | 379 case __REDISPATCHING: |
380 _initial=false; | |
381 _state=__REDISPATCHED; | |
382 return false; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
383 |
865 | 384 case __COMPLETING: |
385 _initial=false; | |
386 _state=__UNCOMPLETED; | |
387 return true; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
388 |
865 | 389 default: |
390 throw new IllegalStateException(this.getStatusString()); | |
391 } | |
392 } | |
393 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
394 |
865 | 395 /* ------------------------------------------------------------ */ |
396 public void dispatch() | |
397 { | |
398 boolean dispatch=false; | |
399 synchronized (this) | |
400 { | |
401 switch(_state) | |
402 { | |
403 case __ASYNCSTARTED: | |
404 _state=__REDISPATCHING; | |
405 _resumed=true; | |
406 return; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
407 |
865 | 408 case __ASYNCWAIT: |
409 dispatch=!_expired; | |
410 _state=__REDISPATCH; | |
411 _resumed=true; | |
412 break; | |
413 | |
414 case __REDISPATCH: | |
415 return; | |
416 | |
417 default: | |
418 throw new IllegalStateException(this.getStatusString()); | |
419 } | |
420 } | |
421 | |
422 if (dispatch) | |
423 { | |
424 cancelTimeout(); | |
425 scheduleDispatch(); | |
426 } | |
427 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
428 |
865 | 429 /* ------------------------------------------------------------ */ |
430 protected void expired() | |
431 { | |
432 final List<ContinuationListener> cListeners; | |
433 final List<AsyncListener> aListeners; | |
434 synchronized (this) | |
435 { | |
436 switch(_state) | |
437 { | |
438 case __ASYNCSTARTED: | |
439 case __ASYNCWAIT: | |
440 cListeners=_continuationListeners; | |
441 aListeners=_asyncListeners; | |
442 break; | |
443 default: | |
444 cListeners=null; | |
445 aListeners=null; | |
446 return; | |
447 } | |
448 _expired=true; | |
449 } | |
450 | |
451 if (aListeners!=null) | |
452 { | |
453 for (AsyncListener listener : aListeners) | |
454 { | |
455 try | |
456 { | |
457 listener.onTimeout(_event); | |
458 } | |
459 catch(Exception e) | |
460 { | |
461 LOG.debug("",e); | |
462 _connection.getRequest().setAttribute(RequestDispatcher.ERROR_EXCEPTION,e); | |
463 break; | |
464 } | |
465 } | |
466 } | |
467 if (cListeners!=null) | |
468 { | |
469 for (ContinuationListener listener : cListeners) | |
470 { | |
471 try | |
472 { | |
473 listener.onTimeout(this); | |
474 } | |
475 catch(Exception e) | |
476 { | |
477 LOG.warn("",e); | |
478 } | |
479 } | |
480 } | |
481 | |
482 synchronized (this) | |
483 { | |
484 switch(_state) | |
485 { | |
486 case __ASYNCSTARTED: | |
487 case __ASYNCWAIT: | |
488 dispatch(); | |
489 break; | |
490 | |
491 default: | |
492 if (!_continuation) | |
493 _expired=false; | |
494 } | |
495 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
496 |
865 | 497 scheduleDispatch(); |
498 } | |
499 | |
500 /* ------------------------------------------------------------ */ | |
501 /* (non-Javadoc) | |
502 * @see javax.servlet.ServletRequest#complete() | |
503 */ | |
504 public void complete() | |
505 { | |
506 // just like resume, except don't set _resumed=true; | |
507 boolean dispatch=false; | |
508 synchronized (this) | |
509 { | |
510 switch(_state) | |
511 { | |
512 case __DISPATCHED: | |
513 case __REDISPATCHED: | |
514 throw new IllegalStateException(this.getStatusString()); | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
515 |
865 | 516 case __ASYNCSTARTED: |
517 _state=__COMPLETING; | |
518 return; | |
519 | |
520 case __ASYNCWAIT: | |
521 _state=__COMPLETING; | |
522 dispatch=!_expired; | |
523 break; | |
524 | |
525 default: | |
526 throw new IllegalStateException(this.getStatusString()); | |
527 } | |
528 } | |
529 | |
530 if (dispatch) | |
531 { | |
532 cancelTimeout(); | |
533 scheduleDispatch(); | |
534 } | |
535 } | |
536 | |
537 /* ------------------------------------------------------------ */ | |
538 /* (non-Javadoc) | |
539 * @see javax.servlet.ServletRequest#complete() | |
540 */ | |
541 public void errorComplete() | |
542 { | |
543 // just like complete except can overrule a prior dispatch call; | |
544 synchronized (this) | |
545 { | |
546 switch(_state) | |
547 { | |
548 case __REDISPATCHING: | |
549 case __ASYNCSTARTED: | |
550 _state=__COMPLETING; | |
551 _resumed=false; | |
552 return; | |
553 | |
554 case __COMPLETING: | |
555 return; | |
556 | |
557 default: | |
558 throw new IllegalStateException(this.getStatusString()); | |
559 } | |
560 } | |
561 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
562 |
865 | 563 /* ------------------------------------------------------------ */ |
564 @Override | |
565 public <T extends AsyncListener> T createListener(Class<T> clazz) throws ServletException | |
566 { | |
567 try | |
568 { | |
569 // TODO inject | |
570 return clazz.newInstance(); | |
571 } | |
572 catch(Exception e) | |
573 { | |
574 throw new ServletException(e); | |
575 } | |
576 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
577 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
578 |
865 | 579 /* ------------------------------------------------------------ */ |
580 /* (non-Javadoc) | |
581 * @see javax.servlet.ServletRequest#complete() | |
582 */ | |
583 protected void doComplete(Throwable ex) | |
584 { | |
585 final List<ContinuationListener> cListeners; | |
586 final List<AsyncListener> aListeners; | |
587 synchronized (this) | |
588 { | |
589 switch(_state) | |
590 { | |
591 case __UNCOMPLETED: | |
592 _state=__COMPLETED; | |
593 cListeners=_continuationListeners; | |
594 aListeners=_asyncListeners; | |
595 break; | |
596 | |
597 default: | |
598 cListeners=null; | |
599 aListeners=null; | |
600 throw new IllegalStateException(this.getStatusString()); | |
601 } | |
602 } | |
603 | |
604 if (aListeners!=null) | |
605 { | |
606 for (AsyncListener listener : aListeners) | |
607 { | |
608 try | |
609 { | |
610 if (ex!=null) | |
611 { | |
612 _event.getSuppliedRequest().setAttribute(RequestDispatcher.ERROR_EXCEPTION,ex); | |
613 _event.getSuppliedRequest().setAttribute(RequestDispatcher.ERROR_MESSAGE,ex.getMessage()); | |
614 listener.onError(_event); | |
615 } | |
616 else | |
617 listener.onComplete(_event); | |
618 } | |
619 catch(Exception e) | |
620 { | |
621 LOG.warn("",e); | |
622 } | |
623 } | |
624 } | |
625 if (cListeners!=null) | |
626 { | |
627 for (ContinuationListener listener : cListeners) | |
628 { | |
629 try | |
630 { | |
631 listener.onComplete(this); | |
632 } | |
633 catch(Exception e) | |
634 { | |
635 LOG.warn("",e); | |
636 } | |
637 } | |
638 } | |
639 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
640 |
865 | 641 /* ------------------------------------------------------------ */ |
642 protected void recycle() | |
643 { | |
644 synchronized (this) | |
645 { | |
646 switch(_state) | |
647 { | |
648 case __DISPATCHED: | |
649 case __REDISPATCHED: | |
650 throw new IllegalStateException(getStatusString()); | |
651 default: | |
652 _state=__IDLE; | |
653 } | |
654 _initial = true; | |
655 _resumed=false; | |
656 _expired=false; | |
657 _responseWrapped=false; | |
658 cancelTimeout(); | |
659 _timeoutMs=DEFAULT_TIMEOUT; | |
660 _continuationListeners=null; | |
661 } | |
662 } | |
663 | |
664 /* ------------------------------------------------------------ */ | |
665 public void cancel() | |
666 { | |
667 synchronized (this) | |
668 { | |
669 cancelTimeout(); | |
670 _continuationListeners=null; | |
671 } | |
672 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
673 |
865 | 674 /* ------------------------------------------------------------ */ |
675 protected void scheduleDispatch() | |
676 { | |
677 EndPoint endp=_connection.getEndPoint(); | |
678 if (!endp.isBlocking()) | |
679 { | |
680 ((AsyncEndPoint)endp).asyncDispatch(); | |
681 } | |
682 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
683 |
865 | 684 /* ------------------------------------------------------------ */ |
685 protected void scheduleTimeout() | |
686 { | |
687 EndPoint endp=_connection.getEndPoint(); | |
688 if (_timeoutMs>0) | |
689 { | |
690 if (endp.isBlocking()) | |
691 { | |
692 synchronized(this) | |
693 { | |
694 _expireAt = System.currentTimeMillis()+_timeoutMs; | |
695 long wait=_timeoutMs; | |
696 while (_expireAt>0 && wait>0 && _connection.getServer().isRunning()) | |
697 { | |
698 try | |
699 { | |
700 this.wait(wait); | |
701 } | |
702 catch (InterruptedException e) | |
703 { | |
704 LOG.trace("",e); | |
705 } | |
706 wait=_expireAt-System.currentTimeMillis(); | |
707 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
708 |
865 | 709 if (_expireAt>0 && wait<=0 && _connection.getServer().isRunning()) |
710 { | |
711 expired(); | |
712 } | |
713 } | |
714 } | |
715 else | |
716 { | |
717 ((AsyncEndPoint)endp).scheduleTimeout(_event._timeout,_timeoutMs); | |
718 } | |
719 } | |
720 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
721 |
865 | 722 /* ------------------------------------------------------------ */ |
723 protected void cancelTimeout() | |
724 { | |
725 EndPoint endp=_connection.getEndPoint(); | |
726 if (endp.isBlocking()) | |
727 { | |
728 synchronized(this) | |
729 { | |
730 _expireAt=0; | |
731 this.notifyAll(); | |
732 } | |
733 } | |
734 else | |
735 { | |
736 final AsyncEventState event=_event; | |
737 if (event!=null) | |
738 { | |
739 ((AsyncEndPoint)endp).cancelTimeout(event._timeout); | |
740 } | |
741 } | |
742 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
743 |
865 | 744 /* ------------------------------------------------------------ */ |
745 public boolean isCompleting() | |
746 { | |
747 synchronized (this) | |
748 { | |
749 return _state==__COMPLETING; | |
750 } | |
751 } | |
752 | |
753 /* ------------------------------------------------------------ */ | |
754 boolean isUncompleted() | |
755 { | |
756 synchronized (this) | |
757 { | |
758 return _state==__UNCOMPLETED; | |
759 } | |
760 } | |
761 | |
762 /* ------------------------------------------------------------ */ | |
763 public boolean isComplete() | |
764 { | |
765 synchronized (this) | |
766 { | |
767 return _state==__COMPLETED; | |
768 } | |
769 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
770 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
771 |
865 | 772 /* ------------------------------------------------------------ */ |
773 public boolean isAsyncStarted() | |
774 { | |
775 synchronized (this) | |
776 { | |
777 switch(_state) | |
778 { | |
779 case __ASYNCSTARTED: | |
780 case __REDISPATCHING: | |
781 case __REDISPATCH: | |
782 case __ASYNCWAIT: | |
783 return true; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
784 |
865 | 785 default: |
786 return false; | |
787 } | |
788 } | |
789 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
790 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
791 |
865 | 792 /* ------------------------------------------------------------ */ |
793 public boolean isAsync() | |
794 { | |
795 synchronized (this) | |
796 { | |
797 switch(_state) | |
798 { | |
799 case __IDLE: | |
800 case __DISPATCHED: | |
801 case __UNCOMPLETED: | |
802 case __COMPLETED: | |
803 return false; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
804 |
865 | 805 default: |
806 return true; | |
807 } | |
808 } | |
809 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
810 |
865 | 811 /* ------------------------------------------------------------ */ |
812 public void dispatch(ServletContext context, String path) | |
813 { | |
814 _event._dispatchContext=context; | |
815 _event.setPath(path); | |
816 dispatch(); | |
817 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
818 |
865 | 819 /* ------------------------------------------------------------ */ |
820 public void dispatch(String path) | |
821 { | |
822 _event.setPath(path); | |
823 dispatch(); | |
824 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
825 |
865 | 826 /* ------------------------------------------------------------ */ |
827 public Request getBaseRequest() | |
828 { | |
829 return _connection.getRequest(); | |
830 } | |
831 | |
832 /* ------------------------------------------------------------ */ | |
833 public ServletRequest getRequest() | |
834 { | |
835 if (_event!=null) | |
836 return _event.getSuppliedRequest(); | |
837 return _connection.getRequest(); | |
838 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
839 |
865 | 840 /* ------------------------------------------------------------ */ |
841 public ServletResponse getResponse() | |
842 { | |
843 if (_responseWrapped && _event!=null && _event.getSuppliedResponse()!=null) | |
844 return _event.getSuppliedResponse(); | |
845 return _connection.getResponse(); | |
846 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
847 |
865 | 848 /* ------------------------------------------------------------ */ |
849 public void start(final Runnable run) | |
850 { | |
851 final AsyncEventState event=_event; | |
852 if (event!=null) | |
853 { | |
875
b9aa175d9a29
remove Server.getThreadPool()
Franklin Schmidt <fschmidt@gmail.com>
parents:
865
diff
changeset
|
854 _connection.getServer().threadPool.execute(new Runnable() |
865 | 855 { |
856 public void run() | |
857 { | |
858 ((Context)event.getServletContext()).getContextHandler().handle(run); | |
859 } | |
860 }); | |
861 } | |
862 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
863 |
865 | 864 /* ------------------------------------------------------------ */ |
865 public boolean hasOriginalRequestAndResponse() | |
866 { | |
867 synchronized (this) | |
868 { | |
869 return (_event!=null && _event.getSuppliedRequest()==_connection._request && _event.getSuppliedResponse()==_connection._response); | |
870 } | |
871 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
872 |
865 | 873 /* ------------------------------------------------------------ */ |
874 public ContextHandler getContextHandler() | |
875 { | |
876 final AsyncEventState event=_event; | |
877 if (event!=null) | |
878 return ((Context)event.getServletContext()).getContextHandler(); | |
879 return null; | |
880 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
881 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
882 |
865 | 883 /* ------------------------------------------------------------ */ |
884 /** | |
885 * @see Continuation#isResumed() | |
886 */ | |
887 public boolean isResumed() | |
888 { | |
889 synchronized (this) | |
890 { | |
891 return _resumed; | |
892 } | |
893 } | |
894 /* ------------------------------------------------------------ */ | |
895 /** | |
896 * @see Continuation#isExpired() | |
897 */ | |
898 public boolean isExpired() | |
899 { | |
900 synchronized (this) | |
901 { | |
902 return _expired; | |
903 } | |
904 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
905 |
865 | 906 /* ------------------------------------------------------------ */ |
907 /** | |
908 * @see Continuation#resume() | |
909 */ | |
910 public void resume() | |
911 { | |
912 dispatch(); | |
913 } | |
914 | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
915 |
865 | 916 /* ------------------------------------------------------------ */ |
917 /** | |
918 * @see org.eclipse.jetty.continuation.Continuation#getServletResponse() | |
919 */ | |
920 public ServletResponse getServletResponse() | |
921 { | |
922 if (_responseWrapped && _event!=null && _event.getSuppliedResponse()!=null) | |
923 return _event.getSuppliedResponse(); | |
924 return _connection.getResponse(); | |
925 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
926 |
865 | 927 /* ------------------------------------------------------------ */ |
928 /** | |
929 * @see org.eclipse.jetty.continuation.Continuation#getAttribute(java.lang.String) | |
930 */ | |
931 public Object getAttribute(String name) | |
932 { | |
933 return _connection.getRequest().getAttribute(name); | |
934 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
935 |
865 | 936 /* ------------------------------------------------------------ */ |
937 /** | |
938 * @see org.eclipse.jetty.continuation.Continuation#removeAttribute(java.lang.String) | |
939 */ | |
940 public void removeAttribute(String name) | |
941 { | |
942 _connection.getRequest().removeAttribute(name); | |
943 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
944 |
865 | 945 /* ------------------------------------------------------------ */ |
946 /** | |
947 * @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object) | |
948 */ | |
949 public void setAttribute(String name, Object attribute) | |
950 { | |
951 _connection.getRequest().setAttribute(name,attribute); | |
952 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
953 |
865 | 954 /* ------------------------------------------------------------ */ |
955 /** | |
956 * @see org.eclipse.jetty.continuation.Continuation#undispatch() | |
957 */ | |
958 public void undispatch() | |
959 { | |
960 if (isSuspended()) | |
961 { | |
962 if (LOG.isDebugEnabled()) | |
963 throw new ContinuationThrowable(); | |
964 else | |
965 throw __exception; | |
966 } | |
967 throw new IllegalStateException("!suspended"); | |
968 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
969 |
865 | 970 /* ------------------------------------------------------------ */ |
971 /* ------------------------------------------------------------ */ | |
972 public class AsyncTimeout extends Timeout.Task implements Runnable | |
973 { | |
974 @Override | |
975 public void expired() | |
976 { | |
977 AsyncContinuation.this.expired(); | |
978 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
979 |
865 | 980 @Override |
981 public void run() | |
982 { | |
983 AsyncContinuation.this.expired(); | |
984 } | |
985 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
986 |
865 | 987 /* ------------------------------------------------------------ */ |
988 /* ------------------------------------------------------------ */ | |
989 public class AsyncEventState extends AsyncEvent | |
990 { | |
991 private final ServletContext _suspendedContext; | |
992 private ServletContext _dispatchContext; | |
993 private String _pathInContext; | |
994 private Timeout.Task _timeout= new AsyncTimeout(); | |
995 | |
996 public AsyncEventState(ServletContext context, ServletRequest request, ServletResponse response) | |
997 { | |
998 super(AsyncContinuation.this, request,response); | |
999 _suspendedContext=context; | |
1000 // Get the base request So we can remember the initial paths | |
1001 Request r=_connection.getRequest(); | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
1002 |
865 | 1003 // If we haven't been async dispatched before |
1004 if (r.getAttribute(AsyncContext.ASYNC_REQUEST_URI)==null) | |
1005 { | |
1006 // We are setting these attributes during startAsync, when the spec implies that | |
1007 // they are only available after a call to AsyncContext.dispatch(...); | |
1008 | |
1009 // have we been forwarded before? | |
1010 String uri=(String)r.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI); | |
1011 if (uri!=null) | |
1012 { | |
1013 r.setAttribute(AsyncContext.ASYNC_REQUEST_URI,uri); | |
1014 r.setAttribute(AsyncContext.ASYNC_CONTEXT_PATH,r.getAttribute(RequestDispatcher.FORWARD_CONTEXT_PATH)); | |
1015 r.setAttribute(AsyncContext.ASYNC_SERVLET_PATH,r.getAttribute(RequestDispatcher.FORWARD_SERVLET_PATH)); | |
1016 r.setAttribute(AsyncContext.ASYNC_PATH_INFO,r.getAttribute(RequestDispatcher.FORWARD_PATH_INFO)); | |
1017 r.setAttribute(AsyncContext.ASYNC_QUERY_STRING,r.getAttribute(RequestDispatcher.FORWARD_QUERY_STRING)); | |
1018 } | |
1019 else | |
1020 { | |
1021 r.setAttribute(AsyncContext.ASYNC_REQUEST_URI,r.getRequestURI()); | |
1022 r.setAttribute(AsyncContext.ASYNC_CONTEXT_PATH,r.getContextPath()); | |
1023 r.setAttribute(AsyncContext.ASYNC_SERVLET_PATH,r.getServletPath()); | |
1024 r.setAttribute(AsyncContext.ASYNC_PATH_INFO,r.getPathInfo()); | |
1025 r.setAttribute(AsyncContext.ASYNC_QUERY_STRING,r.getQueryString()); | |
1026 } | |
1027 } | |
1028 } | |
1029 | |
1030 public ServletContext getSuspendedContext() | |
1031 { | |
1032 return _suspendedContext; | |
1033 } | |
1034 | |
1035 public ServletContext getDispatchContext() | |
1036 { | |
1037 return _dispatchContext; | |
1038 } | |
1039 | |
1040 public ServletContext getServletContext() | |
1041 { | |
1042 return _dispatchContext==null?_suspendedContext:_dispatchContext; | |
1043 } | |
1044 | |
1045 public void setPath(String path) | |
1046 { | |
1047 _pathInContext=path; | |
1048 } | |
1049 | |
1050 /* ------------------------------------------------------------ */ | |
1051 /** | |
1052 * @return The path in the context | |
1053 */ | |
1054 public String getPath() | |
1055 { | |
1056 return _pathInContext; | |
1057 } | |
1058 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
1059 } |