org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession Java Examples
The following examples show how to use
org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HtmlFileTransportHandler.java From spring-analysis-note with MIT License | 6 votes |
@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); }
Example #2
Source File: HtmlFileTransportHandler.java From java-technology-stack with MIT License | 6 votes |
@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); }
Example #3
Source File: HtmlFileTransportHandler.java From spring4-understanding with Apache License 2.0 | 6 votes |
@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(UTF8_CHARSET)); } 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); }
Example #4
Source File: JsonpPollingTransportHandler.java From spring4-understanding with Apache License 2.0 | 6 votes |
@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(UTF8_CHARSET)); 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); }
Example #5
Source File: AbstractHttpReceivingTransportHandler.java From spring-analysis-note with MIT License | 5 votes |
@Override public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException { Assert.notNull(wsSession, "No session"); AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; handleRequestInternal(request, response, wsHandler, sockJsSession); }
Example #6
Source File: AbstractHttpSendingTransportHandler.java From spring-analysis-note with MIT License | 5 votes |
@Override public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException { AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; // https://github.com/sockjs/sockjs-client/issues/130 // sockJsSession.setAcceptedProtocol(protocol); // Set content type before writing response.getHeaders().setContentType(getContentType()); handleRequestInternal(request, response, sockJsSession); }
Example #7
Source File: AbstractHttpReceivingTransportHandler.java From java-technology-stack with MIT License | 5 votes |
@Override public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException { Assert.notNull(wsSession, "No session"); AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; handleRequestInternal(request, response, wsHandler, sockJsSession); }
Example #8
Source File: AbstractHttpSendingTransportHandler.java From java-technology-stack with MIT License | 5 votes |
@Override public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException { AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; // https://github.com/sockjs/sockjs-client/issues/130 // sockJsSession.setAcceptedProtocol(protocol); // Set content type before writing response.getHeaders().setContentType(getContentType()); handleRequestInternal(request, response, sockJsSession); }
Example #9
Source File: JsonpReceivingTransportHandler.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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(UTF8_CHARSET)); } catch (IOException ex) { throw new SockJsException("Failed to write to the response body", sockJsSession.getId(), ex); } }
Example #10
Source File: AbstractHttpReceivingTransportHandler.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException { Assert.notNull(wsSession, "No session"); AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; handleRequestInternal(request, response, wsHandler, sockJsSession); }
Example #11
Source File: AbstractHttpSendingTransportHandler.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException { AbstractHttpSockJsSession sockJsSession = (AbstractHttpSockJsSession) wsSession; String protocol = null; // https://github.com/sockjs/sockjs-client/issues/130 sockJsSession.setAcceptedProtocol(protocol); // Set content type before writing response.getHeaders().setContentType(getContentType()); handleRequestInternal(request, response, sockJsSession); }
Example #12
Source File: AbstractHttpReceivingTransportHandler.java From spring-analysis-note with MIT License | 4 votes |
@Override public boolean checkSessionType(SockJsSession session) { return (session instanceof AbstractHttpSockJsSession); }
Example #13
Source File: AbstractHttpReceivingTransportHandler.java From java-technology-stack with MIT License | 4 votes |
@Override public boolean checkSessionType(SockJsSession session) { return (session instanceof AbstractHttpSockJsSession); }