刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 1 | <html><body><pre>
|
| 2 | <%--
|
| 3 | Licensed to the Apache Software Foundation (ASF) under one or more
|
| 4 | contributor license agreements. See the NOTICE file distributed with
|
| 5 | this work for additional information regarding copyright ownership.
|
| 6 | The ASF licenses this file to You under the Apache License, Version 2.0
|
| 7 | (the "License"); you may not use this file except in compliance with
|
| 8 | the License. You may obtain a copy of the License at
|
| 9 |
|
| 10 | http://www.apache.org/licenses/LICENSE-2.0
|
| 11 |
|
| 12 | Unless required by applicable law or agreed to in writing, software
|
| 13 | distributed under the License is distributed on an "AS IS" BASIS,
|
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 15 | See the License for the specific language governing permissions and
|
| 16 | limitations under the License.
|
| 17 | --%>
|
| 18 | <%@page session="false"%>
|
| 19 |
|
| 20 | <pre>
|
| 21 | Use cases:
|
| 22 |
|
| 23 | 1. Simple dispatch
|
| 24 | - servlet does startAsync()
|
| 25 | - background thread calls ctx.dispatch()
|
| 26 | <a href="<%=response.encodeURL("/examples/async/async0")%>"> Async 0 </a>
|
| 27 |
|
| 28 | 2. Simple dispatch
|
| 29 | - servlet does startAsync()
|
| 30 | - background thread calls dispatch(/path/to/jsp)
|
| 31 | <a href="<%=response.encodeURL("/examples/async/async1")%>"> Async 1 </a>
|
| 32 |
|
| 33 | 3. Simple dispatch
|
| 34 | - servlet does startAsync()
|
| 35 | - background thread calls writes and calls complete()
|
| 36 | <a href="<%=response.encodeURL("/examples/async/async2")%>"> Async 2 </a>
|
| 37 |
|
| 38 | 4. Simple dispatch
|
| 39 | - servlet does a startAsync()
|
| 40 | - servlet calls dispatch(/path/to/jsp)
|
| 41 | - servlet calls complete()
|
| 42 | <a href="<%=response.encodeURL("/examples/async/async3")%>"> Async 3 </a>
|
| 43 |
|
| 44 | 3. Timeout s1
|
| 45 | - servlet does a startAsync()
|
| 46 | - servlet does a setAsyncTimeout
|
| 47 | - returns - waits for timeout to happen should return error page
|
| 48 |
|
| 49 | 4. Timeout s2
|
| 50 | - servlet does a startAsync()
|
| 51 | - servlet does a setAsyncTimeout
|
| 52 | - servlet does a addAsyncListener
|
| 53 | - returns - waits for timeout to happen and listener invoked
|
| 54 |
|
| 55 | 5. Dispatch to asyncSupported=false servlet
|
| 56 | - servlet1 does a startAsync()
|
| 57 | - servlet1 dispatches to dispatch(/servlet2)
|
| 58 | - the container calls complete() after servlet2 is complete
|
| 59 | - TODO
|
| 60 |
|
| 61 | 6. Chained dispatch
|
| 62 | - servlet1 does a startAsync
|
| 63 | - servlet1 does a dispatch to servlet2 (asyncsupported=true)
|
| 64 | - servlet2 does a dispatch to servlet3 (asyncsupported=true)
|
| 65 | - servlet3 does a dispatch to servlet4 (asyncsupported=false)
|
| 66 |
|
| 67 |
|
| 68 | 7. Stock ticker
|
| 69 | <a href="<%=response.encodeURL("/examples/async/stockticker")%>"> StockTicker </a>
|
| 70 | </pre>
|
| 71 | </pre></body></html>
|