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.
Al Hobbs wrote:So you get the interface implementation from the registry and then when you cast it to the underlying class it throws a cast exception? It seems like that should work.
Al Hobbs wrote:Yeah, I was thinking you could put the annotation on the interface. That seems like a better design anyway. If you have an interface that acts as a server endpoint, you probably aren't going to use it in another situation where you don't need the annotation. maybe..
Al Hobbs wrote:It seems like what the site says is to put those classes into a service class and then get that service class from the registry.
Al Hobbs wrote:is that the full error message without casting? It seems like something screwy is going on with the class types. The expected class and the given class don't match, so you need to make sure they match up.
Services consist of two main parts: a service interface and a service implementation.
The service interface is how the service will be represented throughout the rest of the registry. Since what gets passed around is normally a proxy, you can't expect to cast a service object down to the implementation class (you'll see a ClassCastException instead). In other words, you should be careful to ensure that your service interface is complete, since Tapestry IoC effectively walls you off from back doors such as casts.