Interface FragmentsRendering
public interface FragmentsRendering
Public API for HTML rendering from a collection or from a stream of
Fragments each with its own view and model. For use with
view technologies such as htmx where multiple
page fragments may be rendered in a single response. Supported as a return
value from a WebFlux controller method.
For full page rendering with a single model and view, use Rendering.
- Since:
- 6.2
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier 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.BuilderCreate a builder and add a fragment with a view name only, also inheriting model attributes from the 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) Create a builder to render 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) Create a builder to render with aPublisherof Fragments.
-
Method Details
-
status
Return the HTTP status to set the response to. -
headers
HttpHeaders headers()Return headers to add to the response. -
fragments
reactor.core.publisher.Flux<Fragment> fragments()Return the fragments to render. -
with
Create a builder and add a fragment with a view name and a model.- Parameters:
viewName- the name of the view for the fragmentmodel- attributes for the fragment in addition to model attributes inherited from the model for the request- Returns:
- this builder
-
with
Create a builder and add a fragment with a view name only, also inheriting model attributes from the model for the request.- Parameters:
viewName- the name of the view for the fragment- Returns:
- this builder
-
withCollection
Create a builder to render with a collection of Fragments. -
withPublisher
static <P extends Publisher<Fragment>> FragmentsRendering.Builder withPublisher(P fragmentsPublisher) Create a builder to render with aPublisherof Fragments. -
withProducer
Variant ofwithPublisher(Publisher)that allows using any producer that can be resolved toPublisherviaReactiveAdapterRegistry.
-