use of org.springframework.web.reactive.result.view.RequestContext in project thymeleaf-tests by thymeleaf.
the class ReactiveTestUtils method buildReactiveContext.
public static ISpringWebFluxContext buildReactiveContext(final Map<String, Object> model, final RequestDataValueProcessor requestDataValueProcessor) {
final ServerWebExchange exchange = new TestingServerWebExchange("reactive07", Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
final TestingMessageSource testingMessageSource = new TestingMessageSource();
final RequestContext requestContext = new RequestContext(exchange, model, testingMessageSource, requestDataValueProcessor);
final SpringWebFluxThymeleafRequestContext thymeleafRequestContext = new SpringWebFluxThymeleafRequestContext(requestContext, exchange);
model.put(SpringContextVariableNames.SPRING_REQUEST_CONTEXT, requestContext);
model.put(SpringContextVariableNames.THYMELEAF_REQUEST_CONTEXT, thymeleafRequestContext);
final TestingSpringWebFluxContext context = new TestingSpringWebFluxContext(exchange);
context.setVariables(model);
return context;
}
Aggregations