Mercurial Hosting > luan
annotate src/org/eclipse/jetty/continuation/ContinuationSupport.java @ 840:0f53601ea489
remove ConcurrentHashSet
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 19 Sep 2016 14:20:18 -0600 |
parents | dfa742c663f9 |
children |
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.continuation; |
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 java.lang.reflect.Constructor; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
22 import javax.servlet.ServletRequest; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
23 import javax.servlet.ServletRequestWrapper; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
24 import javax.servlet.ServletResponse; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 |
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 /** ContinuationSupport. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 * |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
29 * Factory class for accessing Continuation instances, which with either be |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 * native to the container (jetty >= 6), a servlet 3.0 or a faux continuation. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
31 * |
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 public class ContinuationSupport |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
34 { |
829
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
35 /* ------------------------------------------------------------ */ |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
36 /** |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
37 * Get a Continuation. The type of the Continuation returned may |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
38 * vary depending on the container in which the application is |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
39 * deployed. It may be an implementation native to the container (eg |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
40 * org.eclipse.jetty.server.AsyncContinuation) or one of the utility |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
41 * implementations provided such as an internal <code>FauxContinuation</code> |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
42 * or a real implementation like {@link org.eclipse.jetty.continuation.Servlet3Continuation}. |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
43 * @param request The request |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
44 * @return a Continuation instance |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
45 */ |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
46 public static Continuation getContinuation(ServletRequest request) |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
47 { |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
48 Continuation continuation = (Continuation) request.getAttribute(Continuation.ATTRIBUTE); |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
49 if (continuation!=null) |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
50 return continuation; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
51 |
829
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
52 throw new IllegalStateException("!(Jetty || Servlet 3.0 || ContinuationFilter)"); |
dfa742c663f9
remove ContinuationFilter and FauxContinuation
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
53 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
54 } |