Thanks Mark, you've made it clear that annotating the interface is not an
option.
Converting my server endpoint from annotation based to programmatic is not
a problem, nor is implementing ServerApplicationConfig to configure what
were previously @ServerEndpoint elements: value, encoders, decoders,
configurator.
What is not clear is how this will solve the problem of Tomcat not
accepting an interface as an endpoint. Afterall, the programmatic
approach still employs Configurator.getEndpointInstance(), and this is
where I came unstuck with annotations.
Below is the beginnings of my custom ServerApplicationConfig implementation.
public class CustomServerAppConfig implements ServerApplicationConfig {
@Override
public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<?
extends Endpoint>> endpointClasses) {
Set<ServerEndpointConfig> result = new HashSet<>();
for (Class epClass : endpointClasses) {
if (epClass.equals(MyEndpointInterface.class)) {
ServerEndpointConfig sec =
ServerEndpointConfig.Builder.create(epClass,
"/websocket").build();
result.add(sec);
}
}
return result;
}
@Override
public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
return Collections.emptySet();
}
}
Regards,
Chris.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]