On 24/04/2019 07:16, Christopher Dodunski wrote:
> Hi Mark,
> 
> Looking at the Tapestry-IoC Registry code I notice that although it
> constructs a (plastic) service proxy object, it does cast it to its
> associated interface before making it available from the registry's
> getService() method.  So if I move the WebSocket annotations to my
> interface as previously thought, Tomcat should be getting back from the
> registry what it expects: an instance of the interface annotated with
> @ServerEndpoint.
> 
> Just wondering how this sits with your understanding of the WebSocket
> library.

It won't work. From the Java WebSockets specification:

4.1
@ServerEndpoint
This class level annotation signifies that the Java class it decorates
must be deployed by the implementation as a websocket server endpoint
and made available in the URI-space of the websocket implementation.
*The class must be public, concrete, and have a public no-args constructor.*

(my emphasis)

I don't see a way to do this with annotations. You are going to need to
do it programmatically.

The WebSocket examples that ship with Tomcat include several endpoints
configured this way. There are further examples in the unit tests.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to