@Inject public SamplePushMessageSenderInitializer(PushConnectionRegistry pushConnectionRegistry) { super(pushConnectionRegistry); pushMessageSender = new SamplePushMessageSender(pushConnectionRegistry); }
@Override protected void addPushHandlers(final ChannelPipeline pipeline) { pipeline.addLast(PushAuthHandler.NAME, pushAuthHandler); pipeline.addLast(new PushRegistrationHandler(pushConnectionRegistry, PushProtocol.SSE)); pipeline.addLast(new SampleSSEPushClientProtocolHandler()); }
@Override protected PushUserAuth getPushUserAuth(FullHttpRequest request) { final String cid = request.headers().get("X-CUSTOMER_ID"); if (Strings.isNullOrEmpty(cid)) { return new SamplePushUserAuth(HttpResponseStatus.UNAUTHORIZED.code()); } return new SamplePushUserAuth(cid); }
@Override protected PushUserAuth doAuth(FullHttpRequest req) { final Cookies cookies = parseCookies(req); for (final Cookie c : cookies.getAll()) { if(c.getName().equals("userAuthCookie")) { final String customerId = c.getValue(); if (!Strings.isNullOrEmpty(customerId)) { return new SamplePushUserAuth(customerId); } } } return new SamplePushUserAuth(HttpResponseStatus.UNAUTHORIZED.code()); }
portsToChannels.put(port, new SampleWebSocketPushChannelInitializer(port, channelConfig, channelDependencies, clientChannels)); logPortConfigured(port, null); portsToChannels.put(port, new SampleSSEPushChannelInitializer(port, channelConfig, channelDependencies, clientChannels)); logPortConfigured(port, null);
public SampleWebSocketPushChannelInitializer(int port, ChannelConfig channelConfig, ChannelConfig channelDependencies, ChannelGroup channels) { super(port, channelConfig, channelDependencies, channels); pushConnectionRegistry = channelDependencies.get(ZuulDependencyKeys.pushConnectionRegistry); pushAuthHandler = new SamplePushAuthHandler(PushProtocol.WEBSOCKET.getPath()); }
@Override protected void addPushHandlers(final ChannelPipeline pipeline) { pipeline.addLast(PushAuthHandler.NAME, pushAuthHandler); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(PushProtocol.WEBSOCKET.getPath(), null, true)); pipeline.addLast(new PushRegistrationHandler(pushConnectionRegistry, PushProtocol.WEBSOCKET)); pipeline.addLast(new SampleWebSocketPushClientProtocolHandler()); }
@Override public final void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { if (! isAuthenticated()) {
@Override protected PushUserAuth doAuth(FullHttpRequest req) { final Cookies cookies = parseCookies(req); for (final Cookie c : cookies.getAll()) { if(c.getName().equals("userAuthCookie")) { final String customerId = c.getValue(); if (!Strings.isNullOrEmpty(customerId)) { return new SamplePushUserAuth(customerId); } } } return new SamplePushUserAuth(HttpResponseStatus.UNAUTHORIZED.code()); }
portsToChannels.put(port, new SampleWebSocketPushChannelInitializer(port, channelConfig, channelDependencies, clientChannels)); logPortConfigured(port, null); portsToChannels.put(port, new SampleSSEPushChannelInitializer(port, channelConfig, channelDependencies, clientChannels)); logPortConfigured(port, null);
public SampleSSEPushChannelInitializer(int port, ChannelConfig channelConfig, ChannelConfig channelDependencies, ChannelGroup channels) { super(port, channelConfig, channelDependencies, channels); pushConnectionRegistry = channelDependencies.get(ZuulDependencyKeys.pushConnectionRegistry); pushAuthHandler = new SamplePushAuthHandler(PushProtocol.SSE.getPath()); }
@Inject public SamplePushMessageSenderInitializer(PushConnectionRegistry pushConnectionRegistry) { super(pushConnectionRegistry); pushMessageSender = new SamplePushMessageSender(pushConnectionRegistry); }
@Override protected void addPushHandlers(final ChannelPipeline pipeline) { pipeline.addLast(PushAuthHandler.NAME, pushAuthHandler); pipeline.addLast(new PushRegistrationHandler(pushConnectionRegistry, PushProtocol.SSE)); pipeline.addLast(new SampleSSEPushClientProtocolHandler()); }
@Override protected PushUserAuth getPushUserAuth(FullHttpRequest request) { final String cid = request.headers().get("X-CUSTOMER_ID"); if (Strings.isNullOrEmpty(cid)) { return new SamplePushUserAuth(HttpResponseStatus.UNAUTHORIZED.code()); } return new SamplePushUserAuth(cid); }
@Override protected void addPushHandlers(final ChannelPipeline pipeline) { pipeline.addLast(PushAuthHandler.NAME, pushAuthHandler); pipeline.addLast(new WebSocketServerCompressionHandler()); pipeline.addLast(new WebSocketServerProtocolHandler(PushProtocol.WEBSOCKET.getPath(), null, true)); pipeline.addLast(new PushRegistrationHandler(pushConnectionRegistry, PushProtocol.WEBSOCKET)); pipeline.addLast(new SampleWebSocketPushClientProtocolHandler()); }
@Override public final void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { if (! isAuthenticated()) {
public SampleSSEPushChannelInitializer(int port, ChannelConfig channelConfig, ChannelConfig channelDependencies, ChannelGroup channels) { super(port, channelConfig, channelDependencies, channels); pushConnectionRegistry = channelDependencies.get(ZuulDependencyKeys.pushConnectionRegistry); pushAuthHandler = new SamplePushAuthHandler(PushProtocol.SSE.getPath()); }
public SampleWebSocketPushChannelInitializer(int port, ChannelConfig channelConfig, ChannelConfig channelDependencies, ChannelGroup channels) { super(port, channelConfig, channelDependencies, channels); pushConnectionRegistry = channelDependencies.get(ZuulDependencyKeys.pushConnectionRegistry); pushAuthHandler = new SamplePushAuthHandler(PushProtocol.WEBSOCKET.getPath()); }