The HttpSession and ServletContext are hard to retrieve: Add argument types for @OnOpen, @OnMessage, @OnError, and @OnClose methods #219
Labels
duplicate
This issue or pull request already exists
The HTTP session (HttpSession) and application context (ServletContext) are hard to retrieve within a server endpoint right now. The HTTP session can only be retrieved as described in #218. The ServletContext can only be retrieved if the HTTP session exists and if it is HttpSession, and requires retrieving the HttpSession and calling its getServletContext method.
#217 and #218 describe enhancements to make retrieving the HTTP session and application context easier. However, there's an even easier approach that can be implemented.
@onopen, @OnMessage, @onerror, and @onclose methods can have several different types of arguments that the container automatically supplies, such as the Session and various @PathParam arguments, EndpointConfig for @onopen, CloseReason for @onclose, Throwable for @onerror, and various message objects for @OnMessage. I recommend adding the following valid method parameters for all four annotations:
This would make generically retrieving the application context (ServletContext) and HTTP session (HttpSession) much easier.
Affected Versions
[2.0]
The text was updated successfully, but these errors were encountered: