private SocketState doOnDataAvailable() throws IOException { onDataAvailable(); while (isOpen()) { switch (getReadState()) { case PROCESSING: if (!changeReadState(ReadState.PROCESSING, ReadState.WAITING)) { continue; } return SocketState.UPGRADED; case SUSPENDING_PROCESS: if (!changeReadState(ReadState.SUSPENDING_PROCESS, ReadState.SUSPENDED)) { continue; } return SocketState.SUSPENDED; default: throw new IllegalStateException( sm.getString("wsFrameServer.illegalReadState", getReadState())); } } return SocketState.CLOSED; } }
/** * Called when there is data in the ServletInputStream to process. */ public void onDataAvailable() throws IOException { synchronized (connectionReadLock) { while (isOpen() && sis.isReady()) { // Fill up the input buffer with as much data as we can int read = sis.read( inputBuffer, writePos, inputBuffer.length - writePos); if (read == 0) { return; } if (read == -1) { throw new EOFException(); } writePos += read; processInputBuffer(); } } }
SocketState notifyDataAvailable() throws IOException { while (isOpen()) { switch (getReadState()) { case WAITING: if (!changeReadState(ReadState.WAITING, ReadState.PROCESSING)) { continue; } try { return doOnDataAvailable(); } catch (IOException e) { changeReadState(ReadState.CLOSING); throw e; } case SUSPENDING_WAIT: if (!changeReadState(ReadState.SUSPENDING_WAIT, ReadState.SUSPENDED)) { continue; } return SocketState.SUSPENDED; default: throw new IllegalStateException( sm.getString("wsFrameServer.illegalReadState", getReadState())); } } return SocketState.CLOSED; }
negotiatedExtensions, subProtocol, pathParameters, secure, endpointConfig); wsFrame = new WsFrameServer(socketWrapper, wsSession, transformation, applicationClassLoader); wsRemoteEndpointServer.setTransformation(wsFrame.getTransformation()); ep.onOpen(wsSession, endpointConfig); webSocketContainer.registerSession(ep, wsSession);
log.debug("wsFrameServer.onDataAvailable"); if (isOpen() && inputBuffer.hasRemaining() && !isSuspended()) { processInputBuffer(); while (isOpen() && !isSuspended()) { log.debug(sm.getString("wsFrameServer.bytesRead", Integer.toString(read))); processInputBuffer();
case OPEN_READ: try { return wsFrame.notifyDataAvailable(); } catch (WsIOException ws) { close(ws.getCloseReason()); if (wsFrame.isOpen()) { return SocketState.UPGRADED; } else {
@Override public void onDataAvailable() { try { wsFrame.onDataAvailable(); } catch (WsIOException ws) { wsProtocolHandler.close(ws.getCloseReason()); } catch (IOException ioe) { onError(ioe); CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage()); wsProtocolHandler.close(cr); } }
handshakeRequest.getUserPrincipal(), httpSessionId, subProtocol, pathParameters, secure, endpointConfig); WsFrameServer wsFrame = new WsFrameServer( sis, wsSession);
negotiatedExtensions, subProtocol, pathParameters, secure, endpointConfig); wsFrame = new WsFrameServer(socketWrapper, wsSession, transformation, applicationClassLoader); wsRemoteEndpointServer.setTransformation(wsFrame.getTransformation()); ep.onOpen(wsSession, endpointConfig); webSocketContainer.registerSession(ep, wsSession);
log.debug("wsFrameServer.onDataAvailable"); if (isOpen() && inputBuffer.hasRemaining() && !isSuspended()) { processInputBuffer(); while (isOpen() && !isSuspended()) { log.debug(sm.getString("wsFrameServer.bytesRead", Integer.toString(read))); processInputBuffer();
case OPEN_READ: try { return wsFrame.notifyDataAvailable(); } catch (WsIOException ws) { close(ws.getCloseReason()); if (wsFrame.isOpen()) { return SocketState.UPGRADED; } else {
@Override public void onDataAvailable() { try { wsFrame.onDataAvailable(); } catch (WsIOException ws) { wsProtocolHandler.close(ws.getCloseReason()); } catch (EOFException eof) { CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, eof.getMessage()); wsProtocolHandler.close(cr); } catch (IOException ioe) { onError(ioe); CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage()); wsProtocolHandler.close(cr); } }
private SocketState doOnDataAvailable() throws IOException { onDataAvailable(); while (isOpen()) { switch (getReadState()) { case PROCESSING: if (!changeReadState(ReadState.PROCESSING, ReadState.WAITING)) { continue; } return SocketState.UPGRADED; case SUSPENDING_PROCESS: if (!changeReadState(ReadState.SUSPENDING_PROCESS, ReadState.SUSPENDED)) { continue; } return SocketState.SUSPENDED; default: throw new IllegalStateException( sm.getString("wsFrameServer.illegalReadState", getReadState())); } } return SocketState.CLOSED; } }
negotiatedExtensions, subProtocol, pathParameters, secure, endpointConfig); WsFrameServer wsFrame = new WsFrameServer(sis, wsSession, transformation); sos.setWriteListener(new WsWriteListener(this, wsRemoteEndpointServer)); wsRemoteEndpointServer.setTransformation(wsFrame.getTransformation()); ep.onOpen(wsSession, endpointConfig); webSocketContainer.registerSession(ep, wsSession);
/** * Called when there is data in the ServletInputStream to process. */ public void onDataAvailable() throws IOException { synchronized (connectionReadLock) { while (isOpen() && sis.isReady()) { // Fill up the input buffer with as much data as we can int read = sis.read( inputBuffer, writePos, inputBuffer.length - writePos); if (read == 0) { return; } if (read == -1) { throw new EOFException(); } writePos += read; processInputBuffer(); } } }
SocketState notifyDataAvailable() throws IOException { while (isOpen()) { switch (getReadState()) { case WAITING: if (!changeReadState(ReadState.WAITING, ReadState.PROCESSING)) { continue; } try { return doOnDataAvailable(); } catch (IOException e) { changeReadState(ReadState.CLOSING); throw e; } case SUSPENDING_WAIT: if (!changeReadState(ReadState.SUSPENDING_WAIT, ReadState.SUSPENDED)) { continue; } return SocketState.SUSPENDED; default: throw new IllegalStateException( sm.getString("wsFrameServer.illegalReadState", getReadState())); } } return SocketState.CLOSED; }
@Override public void onDataAvailable() { try { wsFrame.onDataAvailable(); } catch (WsIOException ws) { wsProtocolHandler.close(ws.getCloseReason()); } catch (EOFException eof) { CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, eof.getMessage()); wsProtocolHandler.close(cr); } catch (IOException ioe) { onError(ioe); CloseReason cr = new CloseReason( CloseCodes.CLOSED_ABNORMALLY, ioe.getMessage()); wsProtocolHandler.close(cr); } }
negotiatedExtensions, subProtocol, pathParameters, secure, endpointConfig); WsFrameServer wsFrame = new WsFrameServer(sis, wsSession, transformation); sos.setWriteListener(new WsWriteListener(this, wsRemoteEndpointServer)); wsRemoteEndpointServer.setTransformation(wsFrame.getTransformation()); ep.onOpen(wsSession, endpointConfig); webSocketContainer.registerSession(ep, wsSession);
/** * Called when there is data in the ServletInputStream to process. */ public void onDataAvailable() throws IOException { if (log.isDebugEnabled()) { log.debug("wsFrameServer.onDataAvailable"); } synchronized (connectionReadLock) { while (isOpen() && sis.isReady()) { // Fill up the input buffer with as much data as we can int read = sis.read(inputBuffer, writePos, inputBuffer.length - writePos); if (log.isDebugEnabled()) { log.debug(sm.getString("wsFrameServer.bytesRead", Integer.toString(read))); } if (read == 0) { return; } if (read == -1) { throw new EOFException(); } writePos += read; processInputBuffer(); } } }