Search in sources :

Example 1 with RequestContext

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;
}
Also used : ServerWebExchange(org.springframework.web.server.ServerWebExchange) TestingServerWebExchange(org.thymeleaf.spring5.reactive.exchange.TestingServerWebExchange) TestingServerWebExchange(org.thymeleaf.spring5.reactive.exchange.TestingServerWebExchange) TestingSpringWebFluxContext(org.thymeleaf.spring5.reactive.context.TestingSpringWebFluxContext) TestingMessageSource(org.thymeleaf.spring5.reactive.messagesource.TestingMessageSource) SpringWebFluxThymeleafRequestContext(org.thymeleaf.spring5.context.webflux.SpringWebFluxThymeleafRequestContext) RequestContext(org.springframework.web.reactive.result.view.RequestContext) SpringWebFluxThymeleafRequestContext(org.thymeleaf.spring5.context.webflux.SpringWebFluxThymeleafRequestContext)

Aggregations

RequestContext (org.springframework.web.reactive.result.view.RequestContext)1 ServerWebExchange (org.springframework.web.server.ServerWebExchange)1 SpringWebFluxThymeleafRequestContext (org.thymeleaf.spring5.context.webflux.SpringWebFluxThymeleafRequestContext)1 TestingSpringWebFluxContext (org.thymeleaf.spring5.reactive.context.TestingSpringWebFluxContext)1 TestingServerWebExchange (org.thymeleaf.spring5.reactive.exchange.TestingServerWebExchange)1 TestingMessageSource (org.thymeleaf.spring5.reactive.messagesource.TestingMessageSource)1