@Override protected final void sendMessageInternal(String message) throws SockJsTransportFailureException { synchronized (this.responseLock) { this.messageCache.add(message); if (logger.isTraceEnabled()) { logger.trace(this.messageCache.size() + " message(s) to flush in session " + getId()); } if (isActive() && this.readyToSend) { if (logger.isTraceEnabled()) { logger.trace("Session is active, ready to flush."); } cancelHeartbeat(); flushCache(); } else { if (logger.isTraceEnabled()) { logger.trace("Session is not active, not ready to flush."); } } } }
if (ex.getClass().getName().contains("Mapping")) { handleReadError(response, "Payload expected.", sockJsSession.getId()); handleReadError(response, "Broken JSON encoding.", sockJsSession.getId()); handleReadError(response, "Failed to read message(s)", sockJsSession.getId()); return; handleReadError(response, "Payload expected.", sockJsSession.getId()); return;
@Override public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException { String callback = getCallbackParam(request); if (!StringUtils.hasText(callback)) { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); try { response.getBody().write("\"callback\" parameter required".getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { sockJsSession.tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR); throw new SockJsTransportFailureException("Failed to write to response", sockJsSession.getId(), ex); } return; } super.handleRequestInternal(request, response, sockJsSession); }
throw new SockJsTransportFailureException("Failed to handle SockJS receive request", getId(), ex);
throw new SockJsTransportFailureException("Failed to open session", getId(), ex);
@Override protected final void sendMessageInternal(String message) throws SockJsTransportFailureException { synchronized (this.responseLock) { this.messageCache.add(message); if (logger.isTraceEnabled()) { logger.trace(this.messageCache.size() + " message(s) to flush in session " + getId()); } if (isActive() && this.readyToSend) { if (logger.isTraceEnabled()) { logger.trace("Session is active, ready to flush."); } cancelHeartbeat(); flushCache(); } else { if (logger.isTraceEnabled()) { logger.trace("Session is not active, not ready to flush."); } } } }
@Override protected final void sendMessageInternal(String message) throws SockJsTransportFailureException { synchronized (this.responseLock) { this.messageCache.add(message); if (logger.isTraceEnabled()) { logger.trace(this.messageCache.size() + " message(s) to flush in session " + getId()); } if (isActive() && this.readyToSend) { if (logger.isTraceEnabled()) { logger.trace("Session is active, ready to flush."); } cancelHeartbeat(); flushCache(); } else { if (logger.isTraceEnabled()) { logger.trace("Session is not active, not ready to flush."); } } } }
@Override public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, AbstractHttpSockJsSession sockJsSession) throws SockJsException { super.handleRequestInternal(request, response, wsHandler, sockJsSession); try { response.getBody().write("ok".getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { throw new SockJsException("Failed to write to the response body", sockJsSession.getId(), ex); } }
if (ex.getClass().getName().contains("Mapping")) { handleReadError(response, "Payload expected.", sockJsSession.getId()); handleReadError(response, "Broken JSON encoding.", sockJsSession.getId()); handleReadError(response, "Failed to read message(s)", sockJsSession.getId()); return; handleReadError(response, "Payload expected.", sockJsSession.getId()); return;
if (ex.getClass().getName().contains("Mapping")) { handleReadError(response, "Payload expected.", sockJsSession.getId()); handleReadError(response, "Broken JSON encoding.", sockJsSession.getId()); handleReadError(response, "Failed to read message(s)", sockJsSession.getId()); return; handleReadError(response, "Payload expected.", sockJsSession.getId()); return;
@Override public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException { String callback = getCallbackParam(request); if (!StringUtils.hasText(callback)) { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); try { response.getBody().write("\"callback\" parameter required".getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { sockJsSession.tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR); throw new SockJsTransportFailureException("Failed to write to response", sockJsSession.getId(), ex); } return; } super.handleRequestInternal(request, response, sockJsSession); }
@Override public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException { String callback = getCallbackParam(request); if (!StringUtils.hasText(callback)) { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); try { response.getBody().write("\"callback\" parameter required".getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { sockJsSession.tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR); throw new SockJsTransportFailureException("Failed to write to response", sockJsSession.getId(), ex); } return; } super.handleRequestInternal(request, response, sockJsSession); }
@Override public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException { try { String callback = getCallbackParam(request); if (!StringUtils.hasText(callback)) { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); response.getBody().write("\"callback\" parameter required".getBytes(StandardCharsets.UTF_8)); return; } } catch (Throwable ex) { sockJsSession.tryCloseWithSockJsTransportError(ex, CloseStatus.SERVER_ERROR); throw new SockJsTransportFailureException("Failed to send error", sockJsSession.getId(), ex); } super.handleRequestInternal(request, response, sockJsSession); }
throw new SockJsTransportFailureException("Failed to handle SockJS receive request", getId(), ex);
throw new SockJsTransportFailureException("Failed to handle SockJS receive request", getId(), ex);
throw new SockJsTransportFailureException("Failed to open session", getId(), ex);
throw new SockJsTransportFailureException("Failed to open session", getId(), ex);