org.springframework.web.socket.server.HandshakeHandler Java Examples
The following examples show how to use
org.springframework.web.socket.server.HandshakeHandler.
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: WebSocketHandlerRegistrationTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void handshakeHandlerPassedToSockJsRegistration() { WebSocketHandler handler = new TextWebSocketHandler(); HandshakeHandler handshakeHandler = new DefaultHandshakeHandler(); this.registration.addHandler(handler, "/foo").setHandshakeHandler(handshakeHandler).withSockJS(); List<Mapping> mappings = this.registration.getMappings(); assertEquals(1, mappings.size()); Mapping mapping = mappings.get(0); assertEquals(handler, mapping.webSocketHandler); assertEquals("/foo/**", mapping.path); assertNotNull(mapping.sockJsService); WebSocketTransportHandler transportHandler = (WebSocketTransportHandler) mapping.sockJsService.getTransportHandlers().get(TransportType.WEBSOCKET); assertSame(handshakeHandler, transportHandler.getHandshakeHandler()); }
Example #2
Source File: WebSocketHandlerRegistrationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void handshakeHandlerPassedToSockJsRegistration() { WebSocketHandler handler = new TextWebSocketHandler(); HandshakeHandler handshakeHandler = new DefaultHandshakeHandler(); this.registration.addHandler(handler, "/foo").setHandshakeHandler(handshakeHandler).withSockJS(); this.registration.getSockJsServiceRegistration().setTaskScheduler(this.taskScheduler); List<Mapping> mappings = this.registration.getMappings(); assertEquals(1, mappings.size()); Mapping mapping = mappings.get(0); assertEquals(handler, mapping.webSocketHandler); assertEquals("/foo/**", mapping.path); assertNotNull(mapping.sockJsService); WebSocketTransportHandler transportHandler = (WebSocketTransportHandler) mapping.sockJsService.getTransportHandlers().get(TransportType.WEBSOCKET); assertSame(handshakeHandler, transportHandler.getHandshakeHandler()); }
Example #3
Source File: WebSocketHandlerRegistrationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void handshakeHandlerPassedToSockJsRegistration() { WebSocketHandler handler = new TextWebSocketHandler(); HandshakeHandler handshakeHandler = new DefaultHandshakeHandler(); this.registration.addHandler(handler, "/foo").setHandshakeHandler(handshakeHandler).withSockJS(); this.registration.getSockJsServiceRegistration().setTaskScheduler(this.taskScheduler); List<Mapping> mappings = this.registration.getMappings(); assertEquals(1, mappings.size()); Mapping mapping = mappings.get(0); assertEquals(handler, mapping.webSocketHandler); assertEquals("/foo/**", mapping.path); assertNotNull(mapping.sockJsService); WebSocketTransportHandler transportHandler = (WebSocketTransportHandler) mapping.sockJsService.getTransportHandlers().get(TransportType.WEBSOCKET); assertSame(handshakeHandler, transportHandler.getHandshakeHandler()); }
Example #4
Source File: WebSocketHandlerRegistrationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
public Mapping(WebSocketHandler h, String path, HandshakeHandler hh, HandshakeInterceptor[] interceptors) { this.webSocketHandler = h; this.path = path; this.handshakeHandler = hh; this.interceptors = interceptors; this.sockJsService = null; }
Example #5
Source File: ServletWebSocketHandlerRegistration.java From spring-analysis-note with MIT License | 5 votes |
@Override protected void addWebSocketHandlerMapping(MultiValueMap<HttpRequestHandler, String> mappings, WebSocketHandler webSocketHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) { WebSocketHttpRequestHandler httpHandler = new WebSocketHttpRequestHandler(webSocketHandler, handshakeHandler); if (!ObjectUtils.isEmpty(interceptors)) { httpHandler.setHandshakeInterceptors(Arrays.asList(interceptors)); } mappings.add(httpHandler, path); }
Example #6
Source File: ServletWebSocketHandlerRegistration.java From java-technology-stack with MIT License | 5 votes |
@Override protected void addWebSocketHandlerMapping(MultiValueMap<HttpRequestHandler, String> mappings, WebSocketHandler webSocketHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) { WebSocketHttpRequestHandler httpHandler = new WebSocketHttpRequestHandler(webSocketHandler, handshakeHandler); if (!ObjectUtils.isEmpty(interceptors)) { httpHandler.setHandshakeInterceptors(Arrays.asList(interceptors)); } mappings.add(httpHandler, path); }
Example #7
Source File: WebSocketHandlerRegistrationTests.java From java-technology-stack with MIT License | 5 votes |
public Mapping(WebSocketHandler h, String path, HandshakeHandler hh, HandshakeInterceptor[] interceptors) { this.webSocketHandler = h; this.path = path; this.handshakeHandler = hh; this.interceptors = interceptors; this.sockJsService = null; }
Example #8
Source File: ServletWebSocketHandlerRegistration.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected void addWebSocketHandlerMapping(MultiValueMap<HttpRequestHandler, String> mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) { WebSocketHttpRequestHandler httpHandler = new WebSocketHttpRequestHandler(wsHandler, handshakeHandler); if (!ObjectUtils.isEmpty(interceptors)) { httpHandler.setHandshakeInterceptors(Arrays.asList(interceptors)); } mappings.add(httpHandler, path); }
Example #9
Source File: WebSocketHandlerRegistrationTests.java From spring-analysis-note with MIT License | 5 votes |
public Mapping(WebSocketHandler h, String path, HandshakeHandler hh, HandshakeInterceptor[] interceptors) { this.webSocketHandler = h; this.path = path; this.handshakeHandler = hh; this.interceptors = interceptors; this.sockJsService = null; }
Example #10
Source File: AbstractWebSocketHandlerRegistration.java From java-technology-stack with MIT License | 4 votes |
private HandshakeHandler getOrCreateHandshakeHandler() { return (this.handshakeHandler != null ? this.handshakeHandler : new DefaultHandshakeHandler()); }
Example #11
Source File: AbstractWebSocketHandlerRegistration.java From java-technology-stack with MIT License | 4 votes |
@Nullable protected HandshakeHandler getHandshakeHandler() { return this.handshakeHandler; }
Example #12
Source File: AbstractWebSocketHandlerRegistration.java From java-technology-stack with MIT License | 4 votes |
protected abstract void addWebSocketHandlerMapping(M mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path);
Example #13
Source File: AbstractSockJsIntegrationTests.java From java-technology-stack with MIT License | 4 votes |
@Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { HandshakeHandler handshakeHandler = new DefaultHandshakeHandler(this.upgradeStrategy); registry.addHandler(new EchoHandler(), "/echo").setHandshakeHandler(handshakeHandler).withSockJS(); registry.addHandler(testServerHandler(), "/test").setHandshakeHandler(handshakeHandler).withSockJS(); }
Example #14
Source File: WebSocketHandlerRegistrationTests.java From java-technology-stack with MIT License | 4 votes |
@Override protected void addWebSocketHandlerMapping(List<Mapping> mappings, WebSocketHandler handler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) { mappings.add(new Mapping(handler, path, handshakeHandler, interceptors)); }
Example #15
Source File: WebSocketHttpRequestHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
public WebSocketHttpRequestHandler(WebSocketHandler wsHandler, HandshakeHandler handshakeHandler) { Assert.notNull(wsHandler, "wsHandler must not be null"); Assert.notNull(handshakeHandler, "handshakeHandler must not be null"); this.wsHandler = new ExceptionWebSocketHandlerDecorator(new LoggingWebSocketHandlerDecorator(wsHandler)); this.handshakeHandler = handshakeHandler; }
Example #16
Source File: WebSocketHttpRequestHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
/** * Return the HandshakeHandler. */ public HandshakeHandler getHandshakeHandler() { return this.handshakeHandler; }
Example #17
Source File: WebSocketTransportHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
public WebSocketTransportHandler(HandshakeHandler handshakeHandler) { Assert.notNull(handshakeHandler, "handshakeHandler must not be null"); this.handshakeHandler = handshakeHandler; }
Example #18
Source File: WebSocketTransportHandler.java From spring4-understanding with Apache License 2.0 | 4 votes |
public HandshakeHandler getHandshakeHandler() { return this.handshakeHandler; }
Example #19
Source File: WebMvcStompWebSocketEndpointRegistration.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public StompWebSocketEndpointRegistration setHandshakeHandler(HandshakeHandler handshakeHandler) { Assert.notNull(handshakeHandler, "'handshakeHandler' must not be null"); this.handshakeHandler = handshakeHandler; return this; }
Example #20
Source File: AbstractWebSocketHandlerRegistration.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public WebSocketHandlerRegistration setHandshakeHandler(HandshakeHandler handshakeHandler) { this.handshakeHandler = handshakeHandler; return this; }
Example #21
Source File: AbstractWebSocketHandlerRegistration.java From spring4-understanding with Apache License 2.0 | 4 votes |
protected HandshakeHandler getHandshakeHandler() { return this.handshakeHandler; }
Example #22
Source File: AbstractWebSocketHandlerRegistration.java From spring4-understanding with Apache License 2.0 | 4 votes |
private HandshakeHandler getOrCreateHandshakeHandler() { return (this.handshakeHandler != null) ? this.handshakeHandler : new DefaultHandshakeHandler(); }
Example #23
Source File: AbstractWebSocketHandlerRegistration.java From spring4-understanding with Apache License 2.0 | 4 votes |
protected abstract void addWebSocketHandlerMapping(M mappings, WebSocketHandler wsHandler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path);
Example #24
Source File: AbstractSockJsIntegrationTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) { HandshakeHandler handshakeHandler = new DefaultHandshakeHandler(this.upgradeStrategy); registry.addHandler(new EchoHandler(), "/echo").setHandshakeHandler(handshakeHandler).withSockJS(); registry.addHandler(testServerHandler(), "/test").setHandshakeHandler(handshakeHandler).withSockJS(); }
Example #25
Source File: WebSocketHandlerRegistrationTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override protected void addWebSocketHandlerMapping(List<Mapping> mappings, WebSocketHandler handler, HandshakeHandler handshakeHandler, HandshakeInterceptor[] interceptors, String path) { mappings.add(new Mapping(handler, path, handshakeHandler, interceptors)); }
Example #26
Source File: AbstractWebSocketHandlerRegistration.java From java-technology-stack with MIT License | 4 votes |
@Override public WebSocketHandlerRegistration setHandshakeHandler(@Nullable HandshakeHandler handshakeHandler) { this.handshakeHandler = handshakeHandler; return this; }
Example #27
Source File: WebSocketHttpRequestHandler.java From spring-analysis-note with MIT License | 4 votes |
/** * Return the HandshakeHandler. */ public HandshakeHandler getHandshakeHandler() { return this.handshakeHandler; }
Example #28
Source File: WebSocketTransportHandler.java From spring-analysis-note with MIT License | 4 votes |
public WebSocketTransportHandler(HandshakeHandler handshakeHandler) { Assert.notNull(handshakeHandler, "HandshakeHandler must not be null"); this.handshakeHandler = handshakeHandler; }
Example #29
Source File: WebSocketTransportHandler.java From spring-analysis-note with MIT License | 4 votes |
public HandshakeHandler getHandshakeHandler() { return this.handshakeHandler; }
Example #30
Source File: WebMvcStompWebSocketEndpointRegistration.java From spring-analysis-note with MIT License | 4 votes |
@Override public StompWebSocketEndpointRegistration setHandshakeHandler(HandshakeHandler handshakeHandler) { this.handshakeHandler = handshakeHandler; return this; }