use of org.cometd.bayeux.server.BayeuxServer in project ddf by codice.
the class CometdEndpoint method init.
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
bayeuxServer = (BayeuxServer) config.getServletContext().getAttribute(BayeuxServer.ATTRIBUTE);
if (bayeuxServer != null) {
ServerAnnotationProcessor cometdAnnotationProcessor = new ServerAnnotationProcessor(bayeuxServer);
//TODO: don't do this, we need some sort of policy
bayeuxServer.setSecurityPolicy(new DefaultSecurityPolicy() {
@Override
public boolean canCreate(BayeuxServer server, ServerSession session, String channelId, ServerMessage message) {
return true;
}
@Override
public boolean canHandshake(BayeuxServer server, ServerSession session, ServerMessage message) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("canHandshake ServerSession: {} canHandshake ServerMessage: {}", session, message);
}
notificationController.registerUserSession(session, message);
activityController.registerUserSession(session, message);
return true;
}
@Override
public boolean canPublish(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message) {
return true;
}
@Override
public boolean canSubscribe(BayeuxServer server, ServerSession session, ServerChannel channel, ServerMessage message) {
return true;
}
});
searchController.setBayeuxServer(bayeuxServer);
searchService = new SearchService(filterBuilder, searchController);
UserService userService = new UserService(persistentStore);
WorkspaceService workspaceService = new WorkspaceService(persistentStore);
cometdAnnotationProcessor.process(userService);
cometdAnnotationProcessor.process(workspaceService);
cometdAnnotationProcessor.process(searchService);
cometdAnnotationProcessor.process(notificationController);
cometdAnnotationProcessor.process(activityController);
}
}
Aggregations