org.springframework.web.socket.handler.WebSocketHandlerDecorator.unwrap()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.springframework.web.socket.handler.WebSocketHandlerDecorator.unwrap()方法的一些代码示例,展示了WebSocketHandlerDecorator.unwrap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebSocketHandlerDecorator.unwrap()方法的具体详情如下:
包路径:org.springframework.web.socket.handler.WebSocketHandlerDecorator
类名称:WebSocketHandlerDecorator
方法名:unwrap

WebSocketHandlerDecorator.unwrap介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

  1. private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) {
  2. WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler);
  3. if (!(actual instanceof SubProtocolWebSocketHandler)) {
  4. throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler);
  5. }
  6. return (SubProtocolWebSocketHandler) actual;
  7. }

代码示例来源:origin: spring-projects/spring-framework

  1. public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler,
  2. WebSocketServerSockJsSession sockJsSession) {
  3. Assert.notNull(serviceConfig, "serviceConfig must not be null");
  4. Assert.notNull(webSocketHandler, "webSocketHandler must not be null");
  5. Assert.notNull(sockJsSession, "session must not be null");
  6. this.sockJsServiceConfig = serviceConfig;
  7. this.sockJsSession = sockJsSession;
  8. webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler);
  9. this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ?
  10. new ArrayList<>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : Collections.emptyList());
  11. }

代码示例来源:origin: spring-projects/spring-framework

  1. /**
  2. * Determine the sub-protocols supported by the given WebSocketHandler by
  3. * checking whether it is an instance of {@link SubProtocolCapable}.
  4. * @param handler the handler to check
  5. * @return a list of supported protocols, or an empty list if none available
  6. */
  7. protected final List<String> determineHandlerSupportedProtocols(WebSocketHandler handler) {
  8. WebSocketHandler handlerToCheck = WebSocketHandlerDecorator.unwrap(handler);
  9. List<String> subProtocols = null;
  10. if (handlerToCheck instanceof SubProtocolCapable) {
  11. subProtocols = ((SubProtocolCapable) handlerToCheck).getSubProtocols();
  12. }
  13. return (subProtocols != null ? subProtocols : Collections.emptyList());
  14. }

代码示例来源:origin: org.springframework/spring-websocket

  1. private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) {
  2. WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler);
  3. if (!(actual instanceof SubProtocolWebSocketHandler)) {
  4. throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler);
  5. }
  6. return (SubProtocolWebSocketHandler) actual;
  7. }

代码示例来源:origin: ch.rasc/wampspring

  1. private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(
  2. WebSocketHandler wsHandler) {
  3. WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(wsHandler);
  4. Assert.isInstanceOf(SubProtocolWebSocketHandler.class, actual,
  5. "No SubProtocolWebSocketHandler in " + wsHandler);
  6. return (SubProtocolWebSocketHandler) actual;
  7. }

代码示例来源:origin: apache/servicemix-bundles

  1. private static SubProtocolWebSocketHandler unwrapSubProtocolWebSocketHandler(WebSocketHandler handler) {
  2. WebSocketHandler actual = WebSocketHandlerDecorator.unwrap(handler);
  3. if (!(actual instanceof SubProtocolWebSocketHandler)) {
  4. throw new IllegalArgumentException("No SubProtocolWebSocketHandler in " + handler);
  5. }
  6. return (SubProtocolWebSocketHandler) actual;
  7. }

代码示例来源:origin: org.springframework/spring-websocket

  1. public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler,
  2. WebSocketServerSockJsSession sockJsSession) {
  3. Assert.notNull(serviceConfig, "serviceConfig must not be null");
  4. Assert.notNull(webSocketHandler, "webSocketHandler must not be null");
  5. Assert.notNull(sockJsSession, "session must not be null");
  6. this.sockJsServiceConfig = serviceConfig;
  7. this.sockJsSession = sockJsSession;
  8. webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler);
  9. this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ?
  10. new ArrayList<>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : Collections.emptyList());
  11. }

代码示例来源:origin: apache/servicemix-bundles

  1. public SockJsWebSocketHandler(SockJsServiceConfig serviceConfig, WebSocketHandler webSocketHandler,
  2. WebSocketServerSockJsSession sockJsSession) {
  3. Assert.notNull(serviceConfig, "serviceConfig must not be null");
  4. Assert.notNull(webSocketHandler, "webSocketHandler must not be null");
  5. Assert.notNull(sockJsSession, "session must not be null");
  6. this.sockJsServiceConfig = serviceConfig;
  7. this.sockJsSession = sockJsSession;
  8. webSocketHandler = WebSocketHandlerDecorator.unwrap(webSocketHandler);
  9. this.subProtocols = ((webSocketHandler instanceof SubProtocolCapable) ?
  10. new ArrayList<>(((SubProtocolCapable) webSocketHandler).getSubProtocols()) : Collections.emptyList());
  11. }

代码示例来源:origin: org.springframework/spring-websocket

  1. /**
  2. * Determine the sub-protocols supported by the given WebSocketHandler by
  3. * checking whether it is an instance of {@link SubProtocolCapable}.
  4. * @param handler the handler to check
  5. * @return a list of supported protocols, or an empty list if none available
  6. */
  7. protected final List<String> determineHandlerSupportedProtocols(WebSocketHandler handler) {
  8. WebSocketHandler handlerToCheck = WebSocketHandlerDecorator.unwrap(handler);
  9. List<String> subProtocols = null;
  10. if (handlerToCheck instanceof SubProtocolCapable) {
  11. subProtocols = ((SubProtocolCapable) handlerToCheck).getSubProtocols();
  12. }
  13. return (subProtocols != null ? subProtocols : Collections.emptyList());
  14. }

代码示例来源:origin: apache/servicemix-bundles

  1. /**
  2. * Determine the sub-protocols supported by the given WebSocketHandler by
  3. * checking whether it is an instance of {@link SubProtocolCapable}.
  4. * @param handler the handler to check
  5. * @return a list of supported protocols, or an empty list if none available
  6. */
  7. protected final List<String> determineHandlerSupportedProtocols(WebSocketHandler handler) {
  8. WebSocketHandler handlerToCheck = WebSocketHandlerDecorator.unwrap(handler);
  9. List<String> subProtocols = null;
  10. if (handlerToCheck instanceof SubProtocolCapable) {
  11. subProtocols = ((SubProtocolCapable) handlerToCheck).getSubProtocols();
  12. }
  13. return (subProtocols != null ? subProtocols : Collections.emptyList());
  14. }

相关文章