【发布时间】:2017-01-04 06:02:38
【问题描述】:
我使用的是 Spring Boot 4.2。我有一个返回 StreamingBodyResponse (控制台输出)的服务。我想在视图中显示这个输出(最好是百里香,但一切都很好。)现在它只是打开一个浏览器并在那里流式传输它。我想做的是在百里香视图的文本区域中显示流响应和关闭此视图也不应该影响流式传输以在服务器端停止和崩溃。如果有人能指出我正确的方向,那就太好了。
@PostMapping(value="/environment",produces =MediaType.TEXT_PLAIN)
public StreamingResponseBody environmentSubmit(@ModelAttribute Environment environment) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String currentUserName = authentication.getName();
Configuration configuration = Configuration.createFromPostParams(
environment.getDriver(),
environment.getVersion(),
currentUserName);
StreamingResponseBody response =executor.execute(configuration);
return response;
【问题讨论】:
标签: java spring spring-mvc client thymeleaf