[GLASSFISH-19521] provide API for listing the mappings between the classname and URI. Created: 11/Jan/13  Updated: 19/Sep/14

Status: Open
Project: glassfish
Component/s: web_socket
Affects Version/s: None
Fix Version/s: 4.1

Type: New Feature Priority: Critical
Reporter: Anissa Lam Assignee: dannycoward
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Dependency
blocks GLASSFISH-19209 Add console support for WebSocket for... Open

 Description   

Based on discussion on 1/10/2013, the web socket team will provide a REST API that when given the name of an application that has web sockets inside it, will return the list of mapping from classname to URI.

With this, console will provide a page for displaying those info.



 Comments   
Comment by Anissa Lam [ 16/Jan/13 ]

Danny confirmed in an email thread that this feature will not make it to 4.0 release but the one following.
So, re-target to 4.0.1.





[GLASSFISH-19520] provide an API for listing web socket applications Created: 11/Jan/13  Updated: 19/Sep/14

Status: Open
Project: glassfish
Component/s: web_socket
Affects Version/s: 4.0_b70
Fix Version/s: 4.1

Type: New Feature Priority: Critical
Reporter: Anissa Lam Assignee: dannycoward
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Dependency
blocks GLASSFISH-19209 Add console support for WebSocket for... Open

 Description   

Based on the meeting on 1/10/2013, the web socket team will provide the REST API for listing out all the web socket applications. This will allow the console to indicate this information to user when listing out the applications.



 Comments   
Comment by Anissa Lam [ 16/Jan/13 ]

Danny confirmed in an email thread that this feature will not make it to 4.0 release but the one following.
So, re-target to 4.0.1.





[GLASSFISH-20468] Can't send a JMS message from WebSocket's onMessage Created: 05/May/13  Updated: 18/Jun/13

Status: Reopened
Project: glassfish
Component/s: web_socket
Affects Version/s: 4.0_b86_RC2
Fix Version/s: future release

Type: Bug Priority: Major
Reporter: Bruno Borges Assignee: dannycoward
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The following code fails to send an incoming WebSocket message to a JMS queue:

@ServerEndpoint("/websocket")
public class SampleWebSocket implements Serializable {

    @Resource(mappedName = "jms/myQueue")
    private Queue myQueue;
    @Inject
    private JMSContext jmsContext;

    @OnMessage
    public void onMessage(String message, Session client) {
        try {
            jmsContext.createProducer().send(myQueue, message);
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "message sent to queue");
        } catch (RuntimeException ex) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "RE on websocket.onMessage", ex);
        }
    }
}

This is the exception (not logged by GF due to GLASSFISH-20467)

SEVERE:   RE on websocket.onMessage
org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.RequestScoped
	at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:667)
	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:74)
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)
	at org.glassfish.jms.injection.RequestedJMSContextManager$Proxy$_$$_WeldClientProxy.getType(Unknown Source)
	at org.glassfish.jms.injection.InjectableJMSContext.delegate(InjectableJMSContext.java:126)
	at org.glassfish.jms.injection.ForwardingJMSContext.createProducer(ForwardingJMSContext.java:61)
	at org.glassfish.javaee7wsjms.SampleWebSocket.onMessage(SampleWebSocket.java:65)

Because JMSContext is @RequestScoped, and a WebSocket message has the same behaviour as an HTTP request, it should be possible to use the injected JMSContext to send a message to a Queue from WebSocket.onMessage method.

The following code works fine:

@ServerEndpoint("/websocket")
public class SampleWebSocket implements Serializable {

    @Resource(mappedName = "jms/myQueue")
    private Queue myQueue;
    @Resource(lookup = "java:comp/DefaultJMSConnectionFactory")
    private ConnectionFactory defaultConnectionFactory;

    @OnMessage
    public void onMessage(String message, Session client) {
        try (JMSContext context = defaultConnectionFactory.createContext();) {
            context.createProducer().send(myQueue, message);
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "message sent to queue");
        } catch (RuntimeException ex) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "websocket.onMessage", ex);
        }
    }
}

This issue is also related to GLASSFISH-20371 (and it might influence JMS_SPEC-100)



 Comments   
Comment by jjsnyder83 [ 06/May/13 ]

The @Resource works because it's a resource injection of an object that is in JNDI. It is not a CDI-scoped injected object.

The @Inject fails for the same reason as: https://java.net/jira/browse/GLASSFISH-20371

Comment by jjsnyder83 [ 08/May/13 ]

This will require a CDI spec change. See https://issues.jboss.org/browse/CDI-370

Comment by jjsnyder83 [ 18/Jun/13 ]

This issue really is a usage issue of the JMSContext. The JMSContext requires a global Transaction or an active CDI request context. At the time the injected JMSContext is being used there is no global transaction and no active CDI request context and so the exception is thrown.

There is ongoing discussions on whether the CDI request context can be expanded to account for WebSocket and if WebSocket needs to create its own CDI scope. In any case this issue is a usage issue irt how WebSocket uses the JMSContext.





Generated at Fri May 22 23:55:32 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.