Re: Using WebSockets with a Tapestry WebApp running on Tomcat
Just to clarify, both services being injected the IoC way are developed by me as part of the core program, so nothing sinister to be concerned about. What would be useful to know is whether Tomcat instantiates classes annotated with @ServerEndpoint inside or outside of the context of the WAR app deployed on Tomcat. If outside, probably this means that any endpoint class (static) field values are not shared across ALL instances of the endpoint (the Tapestry service registry also instantiates the endpoint as a service, necessary for pushing messages out, such as with bulk broadcasting). Chris. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Using WebSockets with a Tapestry WebApp running on Tomcat
Hi John, The server-side endpoint is itself implemented as a Tapestry 'service', allowing it to be injected into other application classes for pushing messages out to connected clients. Whereas the service injected into the endpoint class itself allows the endpoint to query this service when a client first connects, then send the client some data in the form of a message to be displayed on the client's UI. The whole point of the mutual injection between these two services (the WebSocket being one) is to allow two way communication - push and pull. Regards, Chris. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Using WebSockets with a Tapestry WebApp running on Tomcat
IoC - *shudders* Can't this be used to "inject" mass surveillance into J2E apps? It was curiously missing in the bullet items down the home page of tapestry. :p So, you're expecting to inject dependencies into components instantiated on a websocket? By "the rest of the application" below, are you referring to application code that's in tapestry, early in the chain of execution, or code that is on/behind your websocket? So, you're looking for some feature in tapestry that would inject some kind of remoteable dependencies into/onto your websocket? This is an interesting question to me .. it to ok me about 10 years, but I created substitutes for both tapestry and HBN/Cayenne. I found that all the source code I needed to deploy ORM/MVC/JSON/HTML5 was 300KB. I like being able to step through JavaScript, then step through Java for debugging without having to negotiate etherial stubs to far off services. Looking forward to hearing about the resources you're trying to have injected into your code. Have a good one, John DB2DOM.COM On 4/8/19, Christopher Dodunski wrote: > Hi team, > > I have developed a web application using the Apache Tapestry framework and > deployed on Apache Tomcat. The application also supports WebSocket > connections with desktop clent applications. Following the advice of the > Tapestry community, I included the server-side endpoint within the > Tapestry based application, but added the below declaration to the > AppModule configuration, which basically instructs Tapestry to ignore any > requests to the endpoint URI, leaving Tomcat to handle the request > instead. > > public static void contributeIgnoredPathsFilter(Configuration > configuration) { > configuration.add("/websocket/.*"); > } > > The problem is that, as with any IoC based application, my WebSocket > endpoint relies on dependency injection to interact with the rest of the > application (ie. injected services). And it seems, given that Tomcat is > left to handle WebSocket connections independent of the Tapestry > application, endpoints get instantiated but without the injected > dependencies. So, of course, a null pointer exception occurs once the > endpoint attempts to invoke a dependency method. > > Moreover, presumably Tomcat is instantiating endpoints outside of the > Tapestry realm, meaning that any class (static) field values are not > shared across endpoints instantiated by Tapestry itself. > > Obviously leaving Tomcat to handle these WebSocket connections independent > of the Tapestry application isn't working. Is there a common solution to > what I imagine is a pretty common scenario? I'm not aware of how to have > Tomcat connect to an endpoint instance already instantiated within the > Tapestry application (one potential solution). > > Thanks & regards, > > Chris. > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Using WebSockets with a Tapestry WebApp running on Tomcat
Hi team, I have developed a web application using the Apache Tapestry framework and deployed on Apache Tomcat. The application also supports WebSocket connections with desktop clent applications. Following the advice of the Tapestry community, I included the server-side endpoint within the Tapestry based application, but added the below declaration to the AppModule configuration, which basically instructs Tapestry to ignore any requests to the endpoint URI, leaving Tomcat to handle the request instead. public static void contributeIgnoredPathsFilter(Configuration configuration) { configuration.add("/websocket/.*"); } The problem is that, as with any IoC based application, my WebSocket endpoint relies on dependency injection to interact with the rest of the application (ie. injected services). And it seems, given that Tomcat is left to handle WebSocket connections independent of the Tapestry application, endpoints get instantiated but without the injected dependencies. So, of course, a null pointer exception occurs once the endpoint attempts to invoke a dependency method. Moreover, presumably Tomcat is instantiating endpoints outside of the Tapestry realm, meaning that any class (static) field values are not shared across endpoints instantiated by Tapestry itself. Obviously leaving Tomcat to handle these WebSocket connections independent of the Tapestry application isn't working. Is there a common solution to what I imagine is a pretty common scenario? I'm not aware of how to have Tomcat connect to an endpoint instance already instantiated within the Tapestry application (one potential solution). Thanks & regards, Chris. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org