|
28 | 28 | import java.util.Map;
|
29 | 29 |
|
30 | 30 | /**
|
31 |
| - * HttpContext represents a mapping between the root URI path of an application |
32 |
| - * to a {@link HttpHandler} which is invoked to handle requests destined |
33 |
| - * for that path on the associated HttpServer or HttpsServer. |
34 |
| - * <p> |
35 |
| - * HttpContext instances are created by the create methods in HttpServer |
36 |
| - * and HttpsServer |
37 |
| - * <p> |
38 |
| - * A chain of {@link Filter} objects can be added to a HttpContext. All exchanges processed by the |
39 |
| - * context can be pre- and post-processed by each Filter in the chain. |
| 31 | + * {@code HttpContext} represents a mapping between the root {@link java.net.URI} |
| 32 | + * path of an application to a {@link HttpHandler} which is invoked to handle |
| 33 | + * requests destined for that path on the associated {@link HttpServer} or |
| 34 | + * {@link HttpsServer}. |
| 35 | + * |
| 36 | + * <p> {@code HttpContext} instances are created by the create methods in |
| 37 | + * {@code HttpServer} and {@code HttpsServer}. |
| 38 | + * |
| 39 | + * <p> A chain of {@link Filter} objects can be added to a {@code HttpContext}. |
| 40 | + * All exchanges processed by the context can be pre- and post-processed by each |
| 41 | + * {@code Filter} in the chain. |
| 42 | + * |
40 | 43 | * @since 1.6
|
41 | 44 | */
|
42 | 45 | public abstract class HttpContext {
|
43 | 46 |
|
44 | 47 | /**
|
45 | 48 | * Constructor for subclasses to call.
|
46 | 49 | */
|
47 |
| - protected HttpContext () { |
| 50 | + protected HttpContext() { |
48 | 51 | }
|
49 | 52 |
|
50 | 53 | /**
|
51 |
| - * returns the handler for this context |
52 |
| - * @return the HttpHandler for this context |
| 54 | + * Returns the handler for this context. |
| 55 | + * |
| 56 | + * @return the {@code HttpHandler} for this context |
53 | 57 | */
|
54 |
| - public abstract HttpHandler getHandler () ; |
| 58 | + public abstract HttpHandler getHandler(); |
55 | 59 |
|
56 | 60 | /**
|
57 | 61 | * Sets the handler for this context, if not already set.
|
58 |
| - * @param h the handler to set for this context |
59 |
| - * @throws IllegalArgumentException if this context's handler is already set. |
60 |
| - * @throws NullPointerException if handler is <code>null</code> |
| 62 | + * |
| 63 | + * @param handler the handler to set for this context |
| 64 | + * @throws IllegalArgumentException if the context for this handler is already set. |
| 65 | + * @throws NullPointerException if handler is {@code null} |
61 | 66 | */
|
62 |
| - public abstract void setHandler (HttpHandler h) ; |
| 67 | + public abstract void setHandler(HttpHandler handler); |
63 | 68 |
|
64 | 69 | /**
|
65 |
| - * returns the path this context was created with |
66 |
| - * @return this context's path |
| 70 | + * Returns the path this context was created with. |
| 71 | + * |
| 72 | + * @return the context of this path |
67 | 73 | */
|
68 |
| - public abstract String getPath() ; |
| 74 | + public abstract String getPath(); |
69 | 75 |
|
70 | 76 | /**
|
71 |
| - * returns the server this context was created with |
72 |
| - * @return this context's server |
| 77 | + * Returns the server this context was created with. |
| 78 | + * |
| 79 | + * @return the context of this server |
73 | 80 | */
|
74 |
| - public abstract HttpServer getServer () ; |
| 81 | + public abstract HttpServer getServer(); |
75 | 82 |
|
76 | 83 | /**
|
77 |
| - * returns a mutable Map, which can be used to pass |
78 |
| - * configuration and other data to Filter modules |
79 |
| - * and to the context's exchange handler. |
80 |
| - * <p> |
81 |
| - * Every attribute stored in this Map will be visible to |
82 |
| - * every HttpExchange processed by this context |
| 84 | + * Returns a mutable {@link Map}, which can be used to pass configuration |
| 85 | + * and other data to {@link Filter} modules and to the context's exchange |
| 86 | + * handler. |
| 87 | + * |
| 88 | + * <p> Every attribute stored in this {@code Map} will be visible to every |
| 89 | + * {@code HttpExchange} processed by this context. |
83 | 90 | *
|
84 |
| - * @return a map containing the attributes of this context |
| 91 | + * @return a {@code Map} containing the attributes of this context |
85 | 92 | */
|
86 | 93 | public abstract Map<String,Object> getAttributes() ;
|
87 | 94 |
|
88 | 95 | /**
|
89 |
| - * returns this context's list of Filters. This is the |
90 |
| - * actual list used by the server when dispatching requests |
91 |
| - * so modifications to this list immediately affect the |
92 |
| - * the handling of exchanges. |
| 96 | + * Returns this context's {@link List} of {@linkplain Filter filters}. This |
| 97 | + * is the actual list used by the server when dispatching requests so |
| 98 | + * modifications to this list immediately affect the the handling of exchanges. |
| 99 | + * |
| 100 | + * @return a {@link List} containing the filters of this context |
93 | 101 | */
|
94 | 102 | public abstract List<Filter> getFilters();
|
95 | 103 |
|
96 | 104 | /**
|
97 |
| - * Sets the Authenticator for this HttpContext. Once an authenticator |
98 |
| - * is establised on a context, all client requests must be |
99 |
| - * authenticated, and the given object will be invoked to validate each |
100 |
| - * request. Each call to this method replaces any previous value set. |
101 |
| - * @param auth the authenticator to set. If <code>null</code> then any |
102 |
| - * previously set authenticator is removed, |
103 |
| - * and client authentication will no longer be required. |
104 |
| - * @return the previous Authenticator, if any set, or <code>null</code> |
105 |
| - * otherwise. |
| 105 | + * Sets the {@link Authenticator} for this {@code HttpContext}. Once an authenticator |
| 106 | + * is establised on a context, all client requests must be authenticated, |
| 107 | + * and the given object will be invoked to validate each request. Each call |
| 108 | + * to this method replaces any previous value set. |
| 109 | + * |
| 110 | + * @param auth the {@code Authenticator} to set. If {@code null} then any previously |
| 111 | + * set {@code Authenticator} is removed, and client authentication |
| 112 | + * will no longer be required. |
| 113 | + * @return the previous {@code Authenticator}, if any set, or {@code null} otherwise. |
106 | 114 | */
|
107 |
| - public abstract Authenticator setAuthenticator (Authenticator auth); |
| 115 | + public abstract Authenticator setAuthenticator(Authenticator auth); |
108 | 116 |
|
109 | 117 | /**
|
110 |
| - * Returns the currently set Authenticator for this context |
| 118 | + * Returns the currently set {@link Authenticator} for this context |
111 | 119 | * if one exists.
|
112 |
| - * @return this HttpContext's Authenticator, or <code>null</code> |
113 |
| - * if none is set. |
| 120 | + * |
| 121 | + * @return this {@linkplain HttpContext HttpContext's} {@code Authenticator}, |
| 122 | + * or {@code null} if none is set |
114 | 123 | */
|
115 |
| - public abstract Authenticator getAuthenticator (); |
| 124 | + public abstract Authenticator getAuthenticator(); |
116 | 125 | }
|
0 commit comments