本文整理汇总了Java中org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport类的典型用法代码示例。如果您正苦于以下问题:Java RestTemplateXhrTransport类的具体用法?Java RestTemplateXhrTransport怎么用?Java RestTemplateXhrTransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RestTemplateXhrTransport类属于org.springframework.web.socket.sockjs.client包,在下文中一共展示了RestTemplateXhrTransport类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
String token = authenticate();
webSocketHttpHeaders = new WebSocketHttpHeaders();
webSocketHttpHeaders.add("Authorization", "Bearer " + token);
blockingQueue = new LinkedBlockingDeque<>();
RestTemplateXhrTransport restTemplateXhrTransport = new RestTemplateXhrTransport();
SockJsClient sockJsClient = new SockJsClient(Arrays.asList(restTemplateXhrTransport));
sockJsClient.setHttpHeaderNames("Authorization");
stompClient = new WebSocketStompClient(sockJsClient);
}
开发者ID:sys-devel-d,项目名称:pimp,代码行数:15,代码来源:NotificationControllerIT.java
示例2: setup
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
log.info("Setting up Quotes Web Socket Integration test....");
port = SocketUtils.findAvailableTcpPort();
server = new TomcatWebSocketTestServer(port);
server.deployConfig(FrontendWebApplicationInitializer.class);
server.start();
loginAndSaveXAuthToken("harrymitchell", "HarryMitchell5!", headers);
List<Transport> transports = new ArrayList<>();
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
RestTemplateXhrTransport xhrTransport = new RestTemplateXhrTransport(new RestTemplate());
xhrTransport.setRequestHeaders(headers);
transports.add(xhrTransport);
sockJsClient = new SockJsClient(transports);
sockJsClient.setHttpHeaderNames("X-Auth-Token");
log.info("Setup complete!");
}
开发者ID:bjornharvold,项目名称:bearchoke,代码行数:22,代码来源:QuotesWebSocketIntegrationTest.java
示例3: run
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@Test
public void run() throws Exception {
List<Transport> transports = new ArrayList<Transport>(2);
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
transports.add(new RestTemplateXhrTransport());
SockJsClient sockJsClient = new SockJsClient(transports);
ListenableFuture<WebSocketSession> wsSession = sockJsClient.doHandshake(
this.webSocketHandler, "ws://localhost:" + this.port + "/sockjs");
this.thrown.expect(ExecutionException.class);
wsSession.get().sendMessage(new TextMessage("a"));
}
开发者ID:xianrendzw,项目名称:CodeMaster,代码行数:14,代码来源:ApplicationTests.java
示例4: setup
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@Before
public void setup() {
List<Transport> transports = Arrays.asList(
new WebSocketTransport(new StandardWebSocketClient()),
new RestTemplateXhrTransport(new RestTemplate()));
this.sockJsClient = new SockJsClient(transports);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:WebSocketMessagingAutoConfigurationTests.java
示例5: setup
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
// Since test classpath includes both embedded Tomcat and Jetty we need to
// set a Spring profile explicitly to bypass WebSocket engine detection.
// See {@link org.springframework.samples.portfolio.config.WebSocketConfig}
// This test is not supported with Jetty because it doesn't seem to support
// deployment withspecific ServletContainerInitializer's at for testing
System.setProperty("spring.profiles.active", "test.tomcat");
port = SocketUtils.findAvailableTcpPort();
server = new TomcatWebSocketTestServer(port);
server.deployConfig(TestDispatcherServletInitializer.class, WebSecurityInitializer.class);
server.start();
loginAndSaveJsessionIdCookie("fabrice", "fab123", headers);
List<Transport> transports = new ArrayList<>();
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
RestTemplateXhrTransport xhrTransport = new RestTemplateXhrTransport(new RestTemplate());
xhrTransport.setRequestHeaders(headers);
transports.add(xhrTransport);
sockJsClient = new SockJsClient(transports);
}
开发者ID:Appverse,项目名称:appverse-server,代码行数:29,代码来源:IntegrationWebsocketTest.java
示例6: createWebSocketClient
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@Override
protected WebSocketClient createWebSocketClient() {
List<Transport> transports = new ArrayList<>(2);
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
transports.add(new RestTemplateXhrTransport());
return new SockJsClient(transports);
}
开发者ID:ralscha,项目名称:wampspring,代码行数:8,代码来源:SockJsTest.java
示例7: run
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@Test
public void run() throws Exception {
List<Transport> transports = new ArrayList<>(2);
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
transports.add(new RestTemplateXhrTransport());
SockJsClient sockJsClient = new SockJsClient(transports);
ListenableFuture<WebSocketSession> wsSession = sockJsClient.doHandshake(
this.webSocketHandler, "ws://localhost:" + this.port + "/sockjs");
this.thrown.expect(ExecutionException.class);
wsSession.get().sendMessage(new TextMessage("a"));
}
开发者ID:spring-projects,项目名称:spring-session,代码行数:14,代码来源:ApplicationTests.java
示例8: PersonWebSocketClient
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
public PersonWebSocketClient(RestTemplate restTemplate) {
this(new SockJsClient(Arrays.asList(new WebSocketTransport(new SSLWebSocketClient()), new RestTemplateXhrTransport(restTemplate))), new MappingJackson2MessageConverter());
}
开发者ID:borysfan,项目名称:websocket-poc,代码行数:4,代码来源:PersonWebSocketClient.java
示例9: setup
import org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
System.setProperty("spring.profiles.active", "test.tomcat");
port = SocketUtils.findAvailableTcpPort();
server = new TomcatWebSocketTestServer(port);
server.deployConfig(TestDispatcherServletInitializer.class);
server.start();
webSocketUri = "ws://localhost:" + port + "/composite/websocket";
List<Transport> transports = new ArrayList<>();
transports.add(new WebSocketTransport(new StandardWebSocketClient()));
RestTemplateXhrTransport xhrTransport = new RestTemplateXhrTransport(new RestTemplate());
xhrTransport.setRequestHeaders(headers);
transports.add(xhrTransport);
sockJsClient = new SockJsClient(transports);
}
开发者ID:wieden-kennedy,项目名称:composite-framework,代码行数:23,代码来源:IntegrationCompositeTests.java
注:本文中的org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论