Java 类org.apache.catalina.websocket.StreamInbound 实例源码

项目:ALLGO    文件:PushServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    int uid = -1;
    if(request.getSession(false) != null){
        uid = (int) request.getSession(false).getAttribute("uid");
    }
    System.out.println("请求登录==>uid:"+uid);
    ChatMessageInbound cmi = new ChatMessageInbound(uid);
    return cmi;
}
项目:rasc    文件:TomcatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol, HttpServletRequest request) {
    try{
        final URI uri = new URI(request.getRequestURI());
        return new MessageInbound() {
            @Override
            protected void onBinaryMessage(ByteBuffer arg0) throws IOException {
            }

            @Override
            protected void onTextMessage(CharBuffer message) throws IOException {
                l.onTextMessage(message);
            }

            @Override
            protected void onOpen(final WsOutbound outbound) {
                l.onOpen(new Connection() {
                    @Override
                    public URI getRequestUri() {
                        return uri;
                    }
                    @Override
                    public void send(CharSequence text) throws IOException {
                        outbound.writeTextMessage(CharBuffer.wrap(text));
                    }
                });
            }

            @Override
            protected void onClose(int status) {
                l.onClose(status);
            }

            private ConnectionListener l = handler.createConnectionListener();
        };
    } catch(URISyntaxException e){
        throw new RuntimeException(e);
    }
}
项目:SynchronizeFX    文件:SynchronizeFXTomcatServlet.java   
@Override
protected StreamInbound createWebSocketInbound(final String subProtocol, final HttpServletRequest request) {
    // TODO validate sub protocol and find out how to refuse connections that send an unsupported sub protocol.
    final String channelName = getChannelName(request);
    synchronized (channels) {
        return new SynchronizeFXTomcatConnection(channels.get(channelName));
    }
}
项目:Ka-Websocket    文件:WebsocketServletImpl.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol, HttpServletRequest request) {
        HandshakeRequest handshakeRequest = new HttpServletHandshakeRequest(request);
        String url = configUtil.getMaping();

        if (endpointConfig.isDynamicAddressing()) {
            url = request.getRequestURI().substring(request.getContextPath().length());
        }

        ClientChannel clientChannel =  endpointConfig.getClientChannelFor(url);
        String username = null;
        try {
             username = clientChannel.authenticate(endpointConfig.getAuthenticationProvider(), handshakeRequest);
        } catch (AuthenticationException e) {
            LOG.error("Unauthorized access for " + request.getRemoteHost(), e);
            throw e;
        }


        WebSocketClientConfig clientConfiguration = endpointConfig.getClientBuilder(clientChannel).get(handshakeRequest)
                                                .url(url)
                                                .username(username)
                                                .protocol(subProtocol, endpointConfig.getProtocolRepository())
                                                .build();
        Tomcat7WebSocketClient client = new Tomcat7WebSocketClient(clientConfiguration);


        if (outboundByteBufferSize != 0) {
            client.setOutboundByteBufferSize(outboundByteBufferSize);
        }
        if (outboundCharBufferSize != 0) {
            client.setOutboundCharBufferSize(outboundCharBufferSize);
        }
        LOG.info("Client connecion created for " + request.getRemoteHost() + " with username " + username + " and ID " + clientConfiguration.getClientId() + " on " + url);
        return client;

}
项目:apache-tomcat-7.0.73-with-comment    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:apache-tomcat-7.0.73-with-comment    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:apache-tomcat-7.0.73-with-comment    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:apache-tomcat-7.0.73-with-comment    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}
项目:apache-tomcat-7.0.73-with-comment    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:apache-tomcat-7.0.73-with-comment    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:apache-tomcat-7.0.73-with-comment    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:apache-tomcat-7.0.73-with-comment    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}
项目:class-guard    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:class-guard    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:class-guard    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:class-guard    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}
项目:trap    文件:WSServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String arg0)
{
    String trapPath = this.reqPath.get();
    return WSServletAdaptor.getSocket(this.ctxPath, trapPath);
}
项目:apache-tomcat-7.0.57    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:apache-tomcat-7.0.57    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:apache-tomcat-7.0.57    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:apache-tomcat-7.0.57    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}
项目:apache-tomcat-7.0.57    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:apache-tomcat-7.0.57    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:apache-tomcat-7.0.57    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:apache-tomcat-7.0.57    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}
项目:wizard    文件:EntranceSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EntranceMessageInbound();
}
项目:orbeon-forms    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:orbeon-forms    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:orbeon-forms    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:orbeon-forms    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}
项目:tomcat7-eap6-examples    文件:EchoMessage.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoMessageInbound(byteBufSize,charBufSize);
}
项目:tomcat7-eap6-examples    文件:EchoStream.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new EchoStreamInbound();
}
项目:tomcat7-eap6-examples    文件:ChatWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new ChatMessageInbound(connectionIds.incrementAndGet());
}
项目:tomcat7-eap6-examples    文件:SnakeWebSocketServlet.java   
@Override
protected StreamInbound createWebSocketInbound(String subProtocol,
        HttpServletRequest request) {
    return new SnakeMessageInbound(connectionIds.incrementAndGet());
}