Skip to content

Instantly share code, notes, and snippets.

@beradrian
Created June 15, 2016 08:46
Show Gist options
  • Save beradrian/1ac488486b68b420175b984699219a54 to your computer and use it in GitHub Desktop.
Save beradrian/1ac488486b68b420175b984699219a54 to your computer and use it in GitHub Desktop.
Websockets config
package com.stefisoft.webchat;
import java.util.HashSet;
import java.util.Set;
import javax.websocket.Endpoint;
import javax.websocket.server.ServerApplicationConfig;
import javax.websocket.server.ServerEndpointConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WebsocketsConfig implements ServerApplicationConfig {
private static final Logger LOG = LoggerFactory.getLogger(WebsocketsConfig.class);
@Override
public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses) {
LOG.trace("Configuring programmatic ServerEndpoints to deploy");
return new HashSet<ServerEndpointConfig>();
}
@Override
public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
LOG.trace("Configuring annotated ServerEndpoints to deploy");
Set<Class<?>> results = new HashSet<Class<?>>();
// for (Class<?> clazz : scanned) {
// if (clazz.getPackage().equals(WebsocketsConfig.class.getPackage())) {
// results.add(clazz);
// }
// }
LOG.trace("Deploy {} annotated ServerEndpoint(s)", results.size());
return results;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment