Class SpringWebFluxContext

    • Constructor Summary

      Constructors 
      Constructor Description
      SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange)
      Build a new instance of this Spring WebFlux-specific context object.
      SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange, Locale locale)
      Build a new instance of this Spring WebFlux-specific context object.
      SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange, Locale locale, Map<String,​Object> variables)
      Build a new instance of this Spring WebFlux-specific context object.
      SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange, org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry, Locale locale, Map<String,​Object> variables)
      Build a new instance of this Spring WebFlux-specific context object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.web.server.ServerWebExchange getExchange()
      Returns the ServerWebExchange object associated with the template execution.
      org.springframework.core.ReactiveAdapterRegistry getReactiveAdapterRegistry()  
      org.springframework.http.server.reactive.ServerHttpRequest getRequest()
      Returns the ServerHttpRequest object associated with the template execution.
      org.springframework.http.server.reactive.ServerHttpResponse getResponse()
      Returns the ServerHttpResponse object associated with the template execution.
      reactor.core.publisher.Mono<org.springframework.web.server.WebSession> getSession()
      Returns the WebSession object associated with the template execution.
      • Methods inherited from class org.thymeleaf.context.AbstractContext

        clearVariables, containsVariable, getLocale, getVariable, getVariableNames, removeVariable, setLocale, setVariable, setVariables
      • Methods inherited from interface org.thymeleaf.context.IContext

        containsVariable, getLocale, getVariable, getVariableNames
    • Constructor Detail

      • SpringWebFluxContext

        public SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange)

        Build a new instance of this Spring WebFlux-specific context object.

        Parameters:
        exchange - the Spring WebFlux exchange object, containing request, response and session. Cannot be null.
      • SpringWebFluxContext

        public SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange,
                                    Locale locale)

        Build a new instance of this Spring WebFlux-specific context object.

        Parameters:
        exchange - the Spring WebFlux exchange object, containing request, response and session. Cannot be null.
        locale - the locale to be used for executing Thymeleaf. Can be null (Locale.getDefault() will be used).
      • SpringWebFluxContext

        public SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange,
                                    Locale locale,
                                    Map<String,​Object> variables)

        Build a new instance of this Spring WebFlux-specific context object.

        Parameters:
        exchange - the Spring WebFlux exchange object, containing request, response and session. Cannot be null.
        locale - the locale to be used for executing Thymeleaf. Can be null (Locale.getDefault() will be used).
        variables - the variables to be used for executing Thymeleaf. Can be null.
      • SpringWebFluxContext

        public SpringWebFluxContext​(org.springframework.web.server.ServerWebExchange exchange,
                                    org.springframework.core.ReactiveAdapterRegistry reactiveAdapterRegistry,
                                    Locale locale,
                                    Map<String,​Object> variables)

        Build a new instance of this Spring WebFlux-specific context object.

        Parameters:
        exchange - the Spring WebFlux exchange object, containing request, response and session. Cannot be null.
        reactiveAdapterRegistry - the Spring WebFlux reactive adapter object, used in cases when it is needed to turn non-Reactor reactive streams (RxJava, etc.) into Reactor equivalents (Flux, Mono) in order to be used by Thymeleaf as data drivers (see IReactiveDataDriverContextVariable). Can be null.
        locale - the locale to be used for executing Thymeleaf. Can be null (Locale.getDefault() will be used).
        variables - the variables to be used for executing Thymeleaf. Can be null.
    • Method Detail

      • getReactiveAdapterRegistry

        public org.springframework.core.ReactiveAdapterRegistry getReactiveAdapterRegistry()
      • getRequest

        public org.springframework.http.server.reactive.ServerHttpRequest getRequest()
        Description copied from interface: ISpringWebFluxContext

        Returns the ServerHttpRequest object associated with the template execution.

        Specified by:
        getRequest in interface ISpringWebFluxContext
        Returns:
        the request object.
      • getSession

        public reactor.core.publisher.Mono<org.springframework.web.server.WebSession> getSession()
        Description copied from interface: ISpringWebFluxContext

        Returns the WebSession object associated with the template execution.

        The returned Mono will always return an instance, either matching the client's session id or a new session. Note that calling this method does not create the session object itself.

        Specified by:
        getSession in interface ISpringWebFluxContext
        Returns:
        the session object. Might be null if no session has been created.
      • getResponse

        public org.springframework.http.server.reactive.ServerHttpResponse getResponse()
        Description copied from interface: ISpringWebFluxContext

        Returns the ServerHttpResponse object associated with the template execution.

        Specified by:
        getResponse in interface ISpringWebFluxContext
        Returns:
        the response object.
      • getExchange

        public org.springframework.web.server.ServerWebExchange getExchange()
        Description copied from interface: ISpringWebFluxContext

        Returns the ServerWebExchange object associated with the template execution.

        Specified by:
        getExchange in interface ISpringWebFluxContext
        Returns:
        the servlet context object.