private void handleReadError(ServerHttpResponse response, String error, String sessionId) { try { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); response.getBody().write(error.getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { throw new SockJsException("Failed to send error: " + error, sessionId, ex); } }
@Override public void start() { try { if (!this.httpClient.isRunning()) { this.httpClient.start(); } } catch (Exception ex) { throw new SockJsException("Failed to start JettyXhrTransport", ex); } }
@Override public void stop() { try { if (this.httpClient.isRunning()) { this.httpClient.stop(); } } catch (Exception ex) { throw new SockJsException("Failed to stop JettyXhrTransport", ex); } }
@Override public void onContent(Response response, ByteBuffer buffer) { while (true) { if (this.sockJsSession.isDisconnected()) { if (logger.isDebugEnabled()) { logger.debug("SockJS sockJsSession closed, closing response."); } response.abort(new SockJsException("Session closed.", this.sockJsSession.getId(), null)); return; } if (buffer.remaining() == 0) { break; } int b = buffer.get(); if (b == '\n') { handleFrame(); } else { this.outputStream.write(b); } } }
@Override public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException { ServerHttpRequest request = new ServletServerHttpRequest(servletRequest); ServerHttpResponse response = new ServletServerHttpResponse(servletResponse); try { this.sockJsService.handleRequest(request, response, getSockJsPath(servletRequest), this.webSocketHandler); } catch (Throwable ex) { throw new SockJsException("Uncaught failure in SockJS request, uri=" + request.getURI(), ex); } }
throw new SockJsException("Failed to write to the response", null, ex);
throw new SockJsException("Session closed.", this.session.getId(), null);
throw new SockJsException("Failed to send " + frame, sockJsSession.getId(), ex); throw new SockJsException("Failed to send " + formattedFrame, sockJsSession.getId(), ex);
failure = new SockJsException("Uncaught failure for request " + request.getURI(), sessionId, ex);
private void handleReadError(ServerHttpResponse response, String error, String sessionId) { try { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); response.getBody().write(error.getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { throw new SockJsException("Failed to send error: " + error, sessionId, ex); } }
private void handleReadError(ServerHttpResponse response, String error, String sessionId) { try { response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR); response.getBody().write(error.getBytes(StandardCharsets.UTF_8)); } catch (IOException ex) { throw new SockJsException("Failed to send error: " + error, sessionId, ex); } }
@Override public void stop() { try { if (this.httpClient.isRunning()) { this.httpClient.stop(); } } catch (Exception ex) { throw new SockJsException("Failed to stop JettyXhrTransport", ex); } }
@Override public void start() { try { if (!this.httpClient.isRunning()) { this.httpClient.start(); } } catch (Exception ex) { throw new SockJsException("Failed to start JettyXhrTransport", ex); } }
@Override public void stop() { try { if (this.httpClient.isRunning()) { this.httpClient.stop(); } } catch (Exception ex) { throw new SockJsException("Failed to stop JettyXhrTransport", ex); } }
@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); } }
@Override public void start() { try { if (!this.httpClient.isRunning()) { this.httpClient.start(); } } catch (Exception ex) { throw new SockJsException("Failed to start JettyXhrTransport", ex); } }
@Override public void onContent(Response response, ByteBuffer buffer) { while (true) { if (this.sockJsSession.isDisconnected()) { if (logger.isDebugEnabled()) { logger.debug("SockJS sockJsSession closed, closing response."); } response.abort(new SockJsException("Session closed.", this.sockJsSession.getId(), null)); return; } if (buffer.remaining() == 0) { break; } int b = buffer.get(); if (b == '\n') { handleFrame(); } else { this.outputStream.write(b); } } }
@Override public void onContent(Response response, ByteBuffer buffer) { while (true) { if (this.sockJsSession.isDisconnected()) { if (logger.isDebugEnabled()) { logger.debug("SockJS sockJsSession closed, closing response."); } response.abort(new SockJsException("Session closed.", this.sockJsSession.getId(), null)); return; } if (buffer.remaining() == 0) { break; } int b = buffer.get(); if (b == '\n') { handleFrame(); } else { this.outputStream.write(b); } } }
@Override public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException { ServerHttpRequest request = new ServletServerHttpRequest(servletRequest); ServerHttpResponse response = new ServletServerHttpResponse(servletResponse); try { this.sockJsService.handleRequest(request, response, getSockJsPath(servletRequest), this.webSocketHandler); } catch (Throwable ex) { throw new SockJsException("Uncaught failure in SockJS request, uri=" + request.getURI(), ex); } }
@Override public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException { ServerHttpRequest request = new ServletServerHttpRequest(servletRequest); ServerHttpResponse response = new ServletServerHttpResponse(servletResponse); try { this.sockJsService.handleRequest(request, response, getSockJsPath(servletRequest), this.webSocketHandler); } catch (Throwable ex) { throw new SockJsException("Uncaught failure in SockJS request, uri=" + request.getURI(), ex); } }