HttpDispatcherContext¶
-
public class
HttpDispatcherContext
extends StatefulServletContext¶ An HttpDispatcherContext is a StatefulServletContext. Additionally it manages the Http request listeners for the HttpDispatcher.
Author: Hugo Y. K. Lam See also:
HttpDispatcher
,HttpRequestListener
Constructors¶
Methods¶
addContext¶
-
public static void
addContext
(String id, HttpDispatcherContext context)¶ Adds an Http dispatcher context to the embeded context store.
Parameters: - id – the ID of the Http dispatcher context.
- context – the Http dispatcher context.
addRequestFilter¶
getContext¶
-
public static HttpDispatcherContext
getContext
(String id)¶ Gets an Http dispatcher context from the embeded context store.
Parameters: - id – the ID of the Http dispatcher context.
Returns: the Http dispatcher context.
getDefaultContext¶
-
public static HttpDispatcherContext
getDefaultContext
()¶ Gets the default Http dispatcher context.
Returns: the default Http dispatcher context.
getListener¶
-
public HttpRequestListener
getListener
(String pathInfo)¶ Gets the Http request listener for the specified path which is relative to its corresponding servlet’s context path. If there is an exact match on the specified path, the registered listener will be returned. Else if there is a wildcard path which matches the specified path, its corresponding registered listener will be returned. Otherwise, null will be returned.
Parameters: - pathInfo – the path information.
Returns: the HttpRequestListener registered at the specified path.
getPathInfo¶
-
public String
getPathInfo
(HttpServletRequest request)¶ Gets the path information from the specified request. The path information will be fixed according to the internal logic of this context if necessary.
Parameters: - request – the Http servlet request.
Returns: the path information.
getRegisteredListenersInfo¶
-
public Properties
getRegisteredListenersInfo
()¶ Gets the information of all registered Http request listeners. The resulted properties will contain a set of pathInfo-listenerName pairs.
Returns: the information as properties.
getRequestFilters¶
-
public Collection
getRequestFilters
()¶ Gets all the request filters in this context.
Returns: all the request filters in this context.
register¶
-
public boolean
register
(String pathInfo, Object requestListener)¶ Registers an Http request listener at a specified path which is relative to its corresponding servlet’s context path.
Parameters: - pathInfo – the path information.
- requestListener – the Http request listener, the class name of the listener, or the class of the listener.
Returns: true if the operation is successful, false otherwise.
register¶
-
public boolean
register
(String pathInfo, Object requestListener, Properties params)¶ Registers an Http request listener at a specified path which is relative to its corresponding servlet’s context path.
Parameters: - pathInfo – the path information.
- requestListener – the Http request listener, the class name of the listener, or the class of the listener.
- params – the parameters of the listener.
Returns: true if the operation is successful, false otherwise.