org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession Java Examples
The following examples show how to use
org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.
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: HttpSendingTransportHandlerTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void htmlFileTransport() throws Exception { HtmlFileTransportHandler transportHandler = new HtmlFileTransportHandler(); transportHandler.initialize(this.sockJsConfig); StreamingSockJsSession session = transportHandler.createSession("1", this.webSocketHandler, null); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals(500, this.servletResponse.getStatus()); assertEquals("\"callback\" parameter required", this.servletResponse.getContentAsString()); resetRequestAndResponse(); setRequest("POST", "/"); this.servletRequest.setQueryString("c=callback"); this.servletRequest.addParameter("c", "callback"); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals("text/html;charset=UTF-8", this.response.getHeaders().getContentType().toString()); assertTrue("Streaming request not started", this.servletRequest.isAsyncStarted()); verify(this.webSocketHandler).afterConnectionEstablished(session); }
Example #2
Source File: HttpSendingTransportHandlerTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void htmlFileTransport() throws Exception { HtmlFileTransportHandler transportHandler = new HtmlFileTransportHandler(); transportHandler.initialize(this.sockJsConfig); StreamingSockJsSession session = transportHandler.createSession("1", this.webSocketHandler, null); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals(500, this.servletResponse.getStatus()); assertEquals("\"callback\" parameter required", this.servletResponse.getContentAsString()); resetRequestAndResponse(); setRequest("POST", "/"); this.servletRequest.setQueryString("c=callback"); this.servletRequest.addParameter("c", "callback"); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals("text/html;charset=UTF-8", this.response.getHeaders().getContentType().toString()); assertTrue("Streaming request not started", this.servletRequest.isAsyncStarted()); verify(this.webSocketHandler).afterConnectionEstablished(session); }
Example #3
Source File: HttpSendingTransportHandlerTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void htmlFileTransport() throws Exception { HtmlFileTransportHandler transportHandler = new HtmlFileTransportHandler(); transportHandler.initialize(this.sockJsConfig); StreamingSockJsSession session = transportHandler.createSession("1", this.webSocketHandler, null); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals(500, this.servletResponse.getStatus()); assertEquals("\"callback\" parameter required", this.servletResponse.getContentAsString()); resetRequestAndResponse(); setRequest("POST", "/"); this.servletRequest.setQueryString("c=callback"); this.servletRequest.addParameter("c", "callback"); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals("text/html;charset=UTF-8", this.response.getHeaders().getContentType().toString()); assertTrue("Streaming request not started", this.servletRequest.isAsyncStarted()); verify(this.webSocketHandler).afterConnectionEstablished(session); }
Example #4
Source File: SubProtocolWebSocketHandler.java From java-technology-stack with MIT License | 5 votes |
private AtomicInteger getCountFor(WebSocketSession session) { if (session instanceof PollingSockJsSession) { return this.httpPolling; } else if (session instanceof StreamingSockJsSession) { return this.httpStreaming; } else { return this.webSocket; } }
Example #5
Source File: HttpSendingTransportHandlerTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void eventSourceTransport() throws Exception { EventSourceTransportHandler transportHandler = new EventSourceTransportHandler(); transportHandler.initialize(this.sockJsConfig); StreamingSockJsSession session = transportHandler.createSession("1", this.webSocketHandler, null); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals("text/event-stream;charset=UTF-8", this.response.getHeaders().getContentType().toString()); assertTrue("Streaming request not started", this.servletRequest.isAsyncStarted()); verify(this.webSocketHandler).afterConnectionEstablished(session); }
Example #6
Source File: SubProtocolWebSocketHandler.java From spring4-understanding with Apache License 2.0 | 5 votes |
private AtomicInteger getCountFor(WebSocketSession session) { if (session instanceof PollingSockJsSession) { return this.httpPolling; } else if (session instanceof StreamingSockJsSession) { return this.httpStreaming; } else { return this.webSocket; } }
Example #7
Source File: HttpSendingTransportHandlerTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void eventSourceTransport() throws Exception { EventSourceTransportHandler transportHandler = new EventSourceTransportHandler(); transportHandler.initialize(this.sockJsConfig); StreamingSockJsSession session = transportHandler.createSession("1", this.webSocketHandler, null); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals("text/event-stream;charset=UTF-8", this.response.getHeaders().getContentType().toString()); assertTrue("Streaming request not started", this.servletRequest.isAsyncStarted()); verify(this.webSocketHandler).afterConnectionEstablished(session); }
Example #8
Source File: HttpSendingTransportHandlerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void eventSourceTransport() throws Exception { EventSourceTransportHandler transportHandler = new EventSourceTransportHandler(); transportHandler.initialize(this.sockJsConfig); StreamingSockJsSession session = transportHandler.createSession("1", this.webSocketHandler, null); transportHandler.handleRequest(this.request, this.response, this.webSocketHandler, session); assertEquals("text/event-stream;charset=UTF-8", this.response.getHeaders().getContentType().toString()); assertTrue("Streaming request not started", this.servletRequest.isAsyncStarted()); verify(this.webSocketHandler).afterConnectionEstablished(session); }
Example #9
Source File: SubProtocolWebSocketHandler.java From spring-analysis-note with MIT License | 5 votes |
AtomicInteger getCountFor(WebSocketSession session) { if (session instanceof PollingSockJsSession) { return this.httpPolling; } else if (session instanceof StreamingSockJsSession) { return this.httpStreaming; } else { return this.webSocket; } }
Example #10
Source File: EventSourceTransportHandler.java From java-technology-stack with MIT License | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new EventSourceStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #11
Source File: XhrStreamingTransportHandler.java From java-technology-stack with MIT License | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new XhrStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #12
Source File: HtmlFileTransportHandler.java From spring-analysis-note with MIT License | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new HtmlFileStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #13
Source File: HtmlFileTransportHandler.java From java-technology-stack with MIT License | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new HtmlFileStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #14
Source File: HtmlFileTransportHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new HtmlFileStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #15
Source File: EventSourceTransportHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new EventSourceStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #16
Source File: XhrStreamingTransportHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new XhrStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #17
Source File: XhrStreamingTransportHandler.java From spring-analysis-note with MIT License | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new XhrStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }
Example #18
Source File: EventSourceTransportHandler.java From spring-analysis-note with MIT License | 4 votes |
@Override public StreamingSockJsSession createSession( String sessionId, WebSocketHandler handler, Map<String, Object> attributes) { return new EventSourceStreamingSockJsSession(sessionId, getServiceConfig(), handler, attributes); }