Interface FragmentsRendering
public interface FragmentsRendering
Public API for HTML rendering of a collection of fragments each with a view
 and independent model. For use with frontends technologies such as
 htmx where multiple page fragments may be
 rendered in one response. Supported as a return value from Spring WebFlux
 controller methods.
 
For full page rendering with a single model and view, use Rendering.
- Since:
- 6.2
- Author:
- Rossen Stoyanchev
- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Flux<Fragment>Return the fragments to render.headers()Return headers to add to the response.status()Return the HTTP status to set the response to.static FragmentsRendering.BuilderVariant ofwith(String, Map)with a view name only, but also inheriting model attributes from the shared model for the request.static FragmentsRendering.BuilderCreate a builder and add a fragment with a view name and a model.static FragmentsRendering.BuilderwithCollection(Collection<Fragment> fragments) Variant ofwith(String, Map)with a collection of fragments.static FragmentsRendering.BuilderwithProducer(Object fragmentsProducer) Variant ofwithPublisher(Publisher)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.static <P extends Publisher<Fragment>>
 FragmentsRendering.BuilderwithPublisher(P fragmentsPublisher) Variant ofwith(String, Map)with aPublisherof fragments.
- 
Method Details- 
statusReturn the HTTP status to set the response to.
- 
headersHttpHeaders headers()Return headers to add to the response.
- 
fragmentsreactor.core.publisher.Flux<Fragment> fragments()Return the fragments to render.
- 
withCreate a builder and add a fragment with a view name and a model.- Parameters:
- viewName- the name of the view for the fragment
- model- attributes for the fragment in addition to model attributes inherited from the model for the request
- Returns:
- this builder
 
- 
withVariant ofwith(String, Map)with a view name only, but also inheriting model attributes from the shared model for the request.- Parameters:
- viewName- the name of the view for the fragment
- Returns:
- this builder
 
- 
withCollectionVariant ofwith(String, Map)with a collection of fragments.- Parameters:
- fragments- the fragments to add; each fragment also inherits model attributes from the shared model for the request
- Returns:
- the created builder
 
- 
withPublisherstatic <P extends Publisher<Fragment>> FragmentsRendering.Builder withPublisher(P fragmentsPublisher) Variant ofwith(String, Map)with aPublisherof fragments.- Parameters:
- fragmentsPublisher- the fragments to add; each fragment also inherits model attributes from the shared model for the request
- Returns:
- the created builder
 
- 
withProducerVariant ofwithPublisher(Publisher)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.
 
-