-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebSocket Spec does not define the activation requirements of CDI Contexts #196
Comments
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented |
@glassfishrobot Commented Thanks! |
@glassfishrobot Commented |
@glassfishrobot Commented |
@mrts Commented It's especially confusing that there is no clearly defined relation to Would the following example serve as acceptance criteria? // -- UserPreferences.java
@SessionScoped
class UserPreferences {
...
}
// -- QuoteEJB.java
@Stateless
@RolesAllowed("users")
public class QuoteEJB {
...
}
// -- QuoteWebSocketServer.java
import javax.websocket.server.ServerEndpoint;
import javax.annotation.security.RolesAllowed;
@ServerEndpoint("/actions")
@RolesAllowed("users") // Doesn't actually work
class QuoteWebSocketServer {
@Inject // Doesn't actually work
private UserPreferences userPreferences;
@EJB // Doesn't actually work
private QuoteEJB quoteEJB;
@OnMessage
public void handleMessage(String message, Session session) {
final List<Topic> topics = userPreferences.getSubscribedTopics();
final List<Quote> quotes = quoteEJB.getQuotesForTopics(topics);
...
}
} |
@mrts Commented |
|
Currently, a few issues are floating around regarding WebSocket spec and the activation (or lack there of) of CDI contexts. As was the case for the JMS spec & the JSF spec, the WebSocket spec must define what the activation is for CDI contexts when it comes to its methods. For example, "managed bean" is only mentioned once in the PFD however its notion is ambiguous:
Some of the non-api features of the Java WebSocket API are optional when the API is not implemented as part of the full Java EE platform, for example, the requirement that websocket endpoints be non-contextual managed beans (see Chapter 7). Such Java EE only features are clearly marked where they are described.
There is nothing in Chapter 7 that mentions "managed bean" as indicated in this chapter. So in my opinion, I think it's needed for the WebSocket spec to spell out that it expects Request Scope to be enabled during an @OnMessage method, and as a result must ensure that the context is initialized when the method is called.
Affected Versions
[1.0]
The text was updated successfully, but these errors were encountered: