Mercurial Hosting > luan
annotate src/org/eclipse/jetty/server/AsyncContinuation.java @ 933:c9513d80f305
remove AsyncContext support
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Sun, 09 Oct 2016 20:25:02 -0600 |
| parents | 947df3056ddb |
| children | fe461f7cfc8e |
| 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.AsyncListener; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
22 import javax.servlet.RequestDispatcher; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
23 import javax.servlet.ServletException; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
24 |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 import java.util.ArrayList; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
26 import java.util.List; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
27 |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 import javax.servlet.ServletContext; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
29 import javax.servlet.ServletRequest; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 import javax.servlet.ServletResponse; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
31 import javax.servlet.http.HttpServletRequest; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
32 |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
33 import org.eclipse.jetty.continuation.Continuation; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
34 import org.eclipse.jetty.continuation.ContinuationListener; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
35 import org.eclipse.jetty.io.AsyncEndPoint; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
36 import org.eclipse.jetty.io.EndPoint; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
37 import org.eclipse.jetty.server.handler.ContextHandler; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
38 import org.eclipse.jetty.server.handler.ContextHandler.Context; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
39 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
|
40 import org.slf4j.Logger; |
|
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
41 import org.slf4j.LoggerFactory; |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
42 import org.eclipse.jetty.util.thread.Timeout; |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
43 |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
44 /* ------------------------------------------------------------ */ |
|
933
c9513d80f305
remove AsyncContext support
Franklin Schmidt <fschmidt@gmail.com>
parents:
932
diff
changeset
|
45 /** Implementation of Continuation interfaces |
|
802
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 */ |
|
933
c9513d80f305
remove AsyncContext support
Franklin Schmidt <fschmidt@gmail.com>
parents:
932
diff
changeset
|
48 public class AsyncContinuation implements Continuation |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
49 { |
| 865 | 50 private static final Logger LOG = LoggerFactory.getLogger(AsyncContinuation.class); |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
51 |
| 865 | 52 private final static long DEFAULT_TIMEOUT=30000L; |
|
931
6f7e2ff51879
remove ContinuationThrowable
Franklin Schmidt <fschmidt@gmail.com>
parents:
930
diff
changeset
|
53 |
| 865 | 54 // STATES: |
| 55 // handling() suspend() unhandle() resume() complete() doComplete() | |
| 56 // startAsync() dispatch() | |
| 57 // IDLE DISPATCHED | |
| 58 // DISPATCHED ASYNCSTARTED UNCOMPLETED | |
| 59 // ASYNCSTARTED ASYNCWAIT REDISPATCHING COMPLETING | |
| 60 // REDISPATCHING REDISPATCHED | |
| 61 // ASYNCWAIT REDISPATCH COMPLETING | |
| 62 // REDISPATCH REDISPATCHED | |
| 63 // REDISPATCHED ASYNCSTARTED UNCOMPLETED | |
| 64 // COMPLETING UNCOMPLETED UNCOMPLETED | |
| 65 // UNCOMPLETED COMPLETED | |
| 66 // COMPLETED | |
| 67 private static final int __IDLE=0; // Idle request | |
| 68 private static final int __DISPATCHED=1; // Request dispatched to filter/servlet | |
| 69 private static final int __UNCOMPLETED=8; // Request is completable | |
| 70 private static final int __COMPLETED=9; // Request is complete | |
| 71 | |
| 72 /* ------------------------------------------------------------ */ | |
| 73 protected AbstractHttpConnection _connection; | |
| 74 private List<AsyncListener> _asyncListeners; | |
| 75 private List<ContinuationListener> _continuationListeners; | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
76 |
| 865 | 77 /* ------------------------------------------------------------ */ |
| 78 private int _state; | |
| 79 private volatile boolean _responseWrapped; | |
| 80 private long _timeoutMs=DEFAULT_TIMEOUT; | |
| 81 private volatile long _expireAt; | |
| 82 | |
| 83 /* ------------------------------------------------------------ */ | |
| 84 protected AsyncContinuation() | |
| 85 { | |
| 86 _state=__IDLE; | |
| 87 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
88 |
| 865 | 89 /* ------------------------------------------------------------ */ |
| 90 protected void setConnection(final AbstractHttpConnection connection) | |
| 91 { | |
| 92 synchronized(this) | |
| 93 { | |
| 94 _connection=connection; | |
| 95 } | |
| 96 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
97 |
| 865 | 98 /* ------------------------------------------------------------ */ |
| 99 public void addListener(AsyncListener listener) | |
| 100 { | |
| 101 synchronized(this) | |
| 102 { | |
| 103 if (_asyncListeners==null) | |
| 104 _asyncListeners=new ArrayList<AsyncListener>(); | |
| 105 _asyncListeners.add(listener); | |
| 106 } | |
| 107 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
108 |
| 865 | 109 /* ------------------------------------------------------------ */ |
| 110 public void addListener(AsyncListener listener,ServletRequest request, ServletResponse response) | |
| 111 { | |
| 112 synchronized(this) | |
| 113 { | |
| 114 // TODO handle the request/response ??? | |
| 115 if (_asyncListeners==null) | |
| 116 _asyncListeners=new ArrayList<AsyncListener>(); | |
| 117 _asyncListeners.add(listener); | |
| 118 } | |
| 119 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
120 |
| 865 | 121 /* ------------------------------------------------------------ */ |
| 122 public void addContinuationListener(ContinuationListener listener) | |
| 123 { | |
| 124 synchronized(this) | |
| 125 { | |
| 126 if (_continuationListeners==null) | |
| 127 _continuationListeners=new ArrayList<ContinuationListener>(); | |
| 128 _continuationListeners.add(listener); | |
| 129 } | |
| 130 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
131 |
| 865 | 132 /* ------------------------------------------------------------ */ |
| 133 public void setTimeout(long ms) | |
| 134 { | |
| 135 synchronized(this) | |
| 136 { | |
| 137 _timeoutMs=ms; | |
| 138 } | |
| 139 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
140 |
| 865 | 141 /* ------------------------------------------------------------ */ |
| 142 public long getTimeout() | |
| 143 { | |
| 144 synchronized(this) | |
| 145 { | |
| 146 return _timeoutMs; | |
| 147 } | |
| 148 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
149 |
| 865 | 150 /* ------------------------------------------------------------ */ |
| 151 /** | |
| 152 * @see org.eclipse.jetty.continuation.Continuation#keepWrappers() | |
| 153 */ | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
154 |
| 865 | 155 /* ------------------------------------------------------------ */ |
| 156 /** | |
| 157 * @see org.eclipse.jetty.continuation.Continuation#isResponseWrapped() | |
| 158 */ | |
| 159 public boolean isResponseWrapped() | |
| 160 { | |
| 161 return _responseWrapped; | |
| 162 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
163 |
| 865 | 164 /* ------------------------------------------------------------ */ |
| 165 /* (non-Javadoc) | |
| 166 * @see javax.servlet.ServletRequest#isSuspended() | |
| 167 */ | |
| 168 public boolean isSuspended() | |
| 169 { | |
| 170 synchronized(this) | |
| 171 { | |
| 172 switch(_state) | |
| 173 { | |
| 174 default: | |
| 175 return false; | |
| 176 } | |
| 177 } | |
| 178 } | |
| 179 | |
| 180 /* ------------------------------------------------------------ */ | |
| 181 public boolean isSuspending() | |
| 182 { | |
| 183 synchronized(this) | |
| 184 { | |
| 185 switch(_state) | |
| 186 { | |
| 187 default: | |
| 188 return false; | |
| 189 } | |
| 190 } | |
| 191 } | |
| 192 | |
| 193 /* ------------------------------------------------------------ */ | |
| 194 public boolean isDispatchable() | |
| 195 { | |
| 196 synchronized(this) | |
| 197 { | |
| 198 switch(_state) | |
| 199 { | |
| 200 default: | |
| 201 return false; | |
| 202 } | |
| 203 } | |
| 204 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
205 |
| 865 | 206 /* ------------------------------------------------------------ */ |
| 207 @Override | |
| 208 public String toString() | |
| 209 { | |
| 210 synchronized (this) | |
| 211 { | |
| 212 return super.toString()+"@"+getStatusString(); | |
| 213 } | |
| 214 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
215 |
| 865 | 216 /* ------------------------------------------------------------ */ |
| 217 public String getStatusString() | |
| 218 { | |
| 219 synchronized (this) | |
| 220 { | |
| 221 return | |
| 222 ((_state==__IDLE)?"IDLE": | |
| 223 (_state==__DISPATCHED)?"DISPATCHED": | |
| 224 (_state==__UNCOMPLETED)?"UNCOMPLETED": | |
| 225 (_state==__COMPLETED)?"COMPLETE": | |
| 929 | 226 ("UNKNOWN?"+_state)); |
| 865 | 227 } |
| 228 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
229 |
| 929 | 230 protected synchronized void handling() |
| 865 | 231 { |
| 929 | 232 switch(_state) |
| 865 | 233 { |
| 929 | 234 case __IDLE: |
| 235 _state=__DISPATCHED; | |
| 236 if (_asyncListeners!=null) | |
| 237 _asyncListeners.clear(); | |
| 238 return; | |
| 239 | |
| 240 default: | |
| 241 throw new IllegalStateException(this.getStatusString()); | |
| 865 | 242 } |
| 243 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
244 |
| 865 | 245 /* ------------------------------------------------------------ */ |
| 246 /** | |
| 247 * Signal that the HttpConnection has finished handling the request. | |
| 248 * For blocking connectors, this call may block if the request has | |
| 249 * been suspended (startAsync called). | |
| 250 * @return true if handling is complete, false if the request should | |
| 251 * be handled again (eg because of a resume that happened before unhandle was called) | |
| 252 */ | |
| 928 | 253 protected synchronized void unhandle() |
| 865 | 254 { |
| 928 | 255 switch(_state) |
| 865 | 256 { |
| 928 | 257 case __DISPATCHED: |
| 258 _state = __UNCOMPLETED; | |
| 259 return; | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
260 |
| 928 | 261 default: |
| 262 throw new IllegalStateException(this.getStatusString()); | |
| 865 | 263 } |
| 264 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
265 |
| 865 | 266 public void dispatch() |
| 267 { | |
| 929 | 268 throw new UnsupportedOperationException(); |
| 865 | 269 } |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
270 |
| 865 | 271 /* ------------------------------------------------------------ */ |
| 272 protected void expired() | |
| 273 { | |
| 274 } | |
| 275 | |
| 276 /* ------------------------------------------------------------ */ | |
| 277 /* (non-Javadoc) | |
| 278 * @see javax.servlet.ServletRequest#complete() | |
| 279 */ | |
| 280 public void complete() | |
| 281 { | |
| 282 // just like resume, except don't set _resumed=true; | |
| 283 boolean dispatch=false; | |
| 284 synchronized (this) | |
| 285 { | |
| 286 switch(_state) | |
| 287 { | |
| 288 case __DISPATCHED: | |
| 289 throw new IllegalStateException(this.getStatusString()); | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
290 |
| 865 | 291 default: |
| 292 throw new IllegalStateException(this.getStatusString()); | |
| 293 } | |
| 294 } | |
| 295 } | |
| 296 | |
| 297 /* ------------------------------------------------------------ */ | |
| 298 /* (non-Javadoc) | |
| 299 * @see javax.servlet.ServletRequest#complete() | |
| 300 */ | |
| 301 public void errorComplete() | |
| 302 { | |
| 303 // just like complete except can overrule a prior dispatch call; | |
| 304 synchronized (this) | |
| 305 { | |
| 306 switch(_state) | |
| 307 { | |
| 308 default: | |
| 309 throw new IllegalStateException(this.getStatusString()); | |
| 310 } | |
| 311 } | |
| 312 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
313 |
| 865 | 314 /* ------------------------------------------------------------ */ |
| 315 /* (non-Javadoc) | |
| 316 * @see javax.servlet.ServletRequest#complete() | |
| 317 */ | |
| 318 protected void doComplete(Throwable ex) | |
| 319 { | |
| 320 final List<ContinuationListener> cListeners; | |
| 321 final List<AsyncListener> aListeners; | |
| 322 synchronized (this) | |
| 323 { | |
| 324 switch(_state) | |
| 325 { | |
| 326 case __UNCOMPLETED: | |
|
918
7b62446899c6
remove unused states in AsyncContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
917
diff
changeset
|
327 _state = __COMPLETED; |
| 865 | 328 cListeners=_continuationListeners; |
| 329 aListeners=_asyncListeners; | |
| 330 break; | |
| 331 | |
| 332 default: | |
| 333 cListeners=null; | |
| 334 aListeners=null; | |
| 335 throw new IllegalStateException(this.getStatusString()); | |
| 336 } | |
| 337 } | |
| 338 | |
| 339 if (aListeners!=null) | |
| 340 { | |
| 341 for (AsyncListener listener : aListeners) | |
| 342 { | |
| 343 try | |
| 344 { | |
| 345 if (ex!=null) | |
| 346 { | |
|
932
947df3056ddb
remove AsyncEventState
Franklin Schmidt <fschmidt@gmail.com>
parents:
931
diff
changeset
|
347 throw new UnsupportedOperationException(); |
| 865 | 348 } |
| 349 else | |
|
932
947df3056ddb
remove AsyncEventState
Franklin Schmidt <fschmidt@gmail.com>
parents:
931
diff
changeset
|
350 listener.onComplete(null); |
| 865 | 351 } |
| 352 catch(Exception e) | |
| 353 { | |
| 354 LOG.warn("",e); | |
| 355 } | |
| 356 } | |
| 357 } | |
| 358 if (cListeners!=null) | |
| 359 { | |
| 360 for (ContinuationListener listener : cListeners) | |
| 361 { | |
| 362 try | |
| 363 { | |
| 364 listener.onComplete(this); | |
| 365 } | |
| 366 catch(Exception e) | |
| 367 { | |
| 368 LOG.warn("",e); | |
| 369 } | |
| 370 } | |
| 371 } | |
| 372 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
373 |
| 865 | 374 /* ------------------------------------------------------------ */ |
| 375 protected void recycle() | |
| 376 { | |
| 377 synchronized (this) | |
| 378 { | |
| 379 switch(_state) | |
| 380 { | |
| 381 case __DISPATCHED: | |
| 382 throw new IllegalStateException(getStatusString()); | |
| 383 default: | |
| 384 _state=__IDLE; | |
| 385 } | |
| 386 _responseWrapped=false; | |
| 387 cancelTimeout(); | |
| 388 _timeoutMs=DEFAULT_TIMEOUT; | |
| 389 _continuationListeners=null; | |
| 390 } | |
| 391 } | |
| 392 | |
| 393 /* ------------------------------------------------------------ */ | |
| 394 protected void cancelTimeout() | |
| 395 { | |
| 396 EndPoint endp=_connection.getEndPoint(); | |
| 397 if (endp.isBlocking()) | |
| 398 { | |
| 399 synchronized(this) | |
| 400 { | |
| 401 _expireAt=0; | |
| 402 this.notifyAll(); | |
| 403 } | |
| 404 } | |
| 405 else | |
| 406 { | |
| 407 } | |
| 408 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
409 |
| 865 | 410 boolean isUncompleted() |
| 411 { | |
| 412 synchronized (this) | |
| 413 { | |
| 414 return _state==__UNCOMPLETED; | |
| 415 } | |
| 416 } | |
| 417 | |
| 418 public boolean isComplete() | |
| 419 { | |
| 420 synchronized (this) | |
| 421 { | |
| 422 return _state==__COMPLETED; | |
| 423 } | |
| 424 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
425 |
| 865 | 426 public void dispatch(ServletContext context, String path) |
| 427 { | |
| 929 | 428 throw new UnsupportedOperationException(); |
| 865 | 429 } |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
430 |
| 865 | 431 public void dispatch(String path) |
| 432 { | |
| 929 | 433 throw new UnsupportedOperationException(); |
| 865 | 434 } |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
435 |
| 865 | 436 /* ------------------------------------------------------------ */ |
| 437 public Request getBaseRequest() | |
| 438 { | |
| 439 return _connection.getRequest(); | |
| 440 } | |
| 441 | |
| 442 /* ------------------------------------------------------------ */ | |
| 443 public ServletRequest getRequest() | |
| 444 { | |
| 445 return _connection.getRequest(); | |
| 446 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
447 |
| 865 | 448 /* ------------------------------------------------------------ */ |
| 449 public ServletResponse getResponse() | |
| 450 { | |
| 451 return _connection.getResponse(); | |
| 452 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
453 |
| 865 | 454 /* ------------------------------------------------------------ */ |
| 455 public void start(final Runnable run) | |
| 456 { | |
| 457 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
458 |
| 865 | 459 /* ------------------------------------------------------------ */ |
| 460 public boolean hasOriginalRequestAndResponse() | |
| 461 { | |
| 462 synchronized (this) | |
| 463 { | |
|
932
947df3056ddb
remove AsyncEventState
Franklin Schmidt <fschmidt@gmail.com>
parents:
931
diff
changeset
|
464 return false; |
| 865 | 465 } |
| 466 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
467 |
| 865 | 468 /* ------------------------------------------------------------ */ |
| 469 public ContextHandler getContextHandler() | |
| 470 { | |
| 471 return null; | |
| 472 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
473 |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
474 |
| 865 | 475 /* ------------------------------------------------------------ */ |
| 476 /** | |
| 477 * @see org.eclipse.jetty.continuation.Continuation#getServletResponse() | |
| 478 */ | |
| 479 public ServletResponse getServletResponse() | |
| 480 { | |
| 481 return _connection.getResponse(); | |
| 482 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
483 |
| 865 | 484 /* ------------------------------------------------------------ */ |
| 485 /** | |
| 486 * @see org.eclipse.jetty.continuation.Continuation#getAttribute(java.lang.String) | |
| 487 */ | |
| 488 public Object getAttribute(String name) | |
| 489 { | |
| 490 return _connection.getRequest().getAttribute(name); | |
| 491 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
492 |
| 865 | 493 /* ------------------------------------------------------------ */ |
| 494 /** | |
| 495 * @see org.eclipse.jetty.continuation.Continuation#removeAttribute(java.lang.String) | |
| 496 */ | |
| 497 public void removeAttribute(String name) | |
| 498 { | |
| 499 _connection.getRequest().removeAttribute(name); | |
| 500 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
501 |
| 865 | 502 /* ------------------------------------------------------------ */ |
| 503 /** | |
| 504 * @see org.eclipse.jetty.continuation.Continuation#setAttribute(java.lang.String, java.lang.Object) | |
| 505 */ | |
| 506 public void setAttribute(String name, Object attribute) | |
| 507 { | |
| 508 _connection.getRequest().setAttribute(name,attribute); | |
| 509 } | |
|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
510 |
|
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
511 } |
