Merge branch '6.2.x'

This commit is contained in:
rstoyanchev
2025-10-30 12:24:39 +00:00
3 changed files with 84 additions and 11 deletions
@@ -68,7 +68,7 @@ public interface FragmentsRendering {
* the shared model for the request.
* @param viewName the name of the view for the fragment
* @return this builder
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragment(String viewName) {
return new DefaultFragmentsRenderingBuilder().fragment(viewName);
@@ -80,7 +80,7 @@ public interface FragmentsRendering {
* @param model attributes for the fragment, in addition to attributes from the
* shared model for the request
* @return this builder
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragment(String viewName, Map<String, Object> model) {
return new DefaultFragmentsRenderingBuilder().fragment(viewName, model);
@@ -91,7 +91,7 @@ public interface FragmentsRendering {
* @param fragments the fragments to add; each fragment also inherits
* attributes from the shared model for the request
* @return the created builder
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragments(Collection<Fragment> fragments) {
return new DefaultFragmentsRenderingBuilder().fragments(fragments);
@@ -102,7 +102,7 @@ public interface FragmentsRendering {
* @param fragmentsPublisher the fragments to add; each fragment also
* inherits model attributes from the shared model for the request
* @return the created builder
* @since 6.2.1
* @since 6.2.13
*/
static <P extends Publisher<Fragment>> Builder fragmentsPublisher(P fragmentsPublisher) {
return new DefaultFragmentsRenderingBuilder(fragmentsPublisher);
@@ -112,7 +112,7 @@ public interface FragmentsRendering {
* Variant of {@link #fragmentsPublisher(Publisher)} that allows using any
* producer that can be resolved to {@link Publisher} via
* {@link ReactiveAdapterRegistry}.
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragmentsProducer(Object fragmentsProducer) {
ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(fragmentsProducer.getClass());
@@ -122,6 +122,52 @@ public interface FragmentsRendering {
}
/**
* The same as {@link #fragment(String, Map)}.
* @deprecated in favor of {@link #fragment(String, Map)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder with(String viewName, Map<String, Object> model) {
return fragment(viewName, model);
}
/**
* The same as {@link #fragments(Collection)}.
* @deprecated in favor of {@link #fragments(Collection)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder with(String viewName) {
return fragment(viewName);
}
/**
* The same as {@link #fragments(Collection)}.
* @deprecated in favor of {@link #fragments(Collection)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder withCollection(Collection<Fragment> fragments) {
return fragments(fragments);
}
/**
* The same as {@link #fragmentsPublisher(Publisher)}.
* @deprecated in favor of {@link #fragmentsPublisher(Publisher)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static <P extends Publisher<Fragment>> Builder withPublisher(P fragmentsPublisher) {
return fragmentsPublisher(fragmentsPublisher);
}
/**
* The same as {@link #fragmentsProducer(Object)}.
* @deprecated in favor of {@link #fragmentsProducer(Object)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder withProducer(Object fragmentsProducer) {
return fragmentsProducer(fragmentsProducer);
}
/**
* Defines a builder for {@link FragmentsRendering}.
*/
@@ -180,7 +226,7 @@ public interface FragmentsRendering {
* @param fragments the fragments to add; each fragment also inherits
* attributes from the shared model for the request
* @return this builder
* @since 6.2.1
* @since 6.2.13
*/
Builder fragments(Collection<Fragment> fragments);
@@ -59,7 +59,7 @@ public interface FragmentsRendering extends SmartView {
* the shared model for the request.
* @param viewName the name of the view for the fragment
* @return the created builder
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragment(String viewName) {
return new DefaultFragmentsRenderingBuilder().fragment(viewName);
@@ -71,7 +71,7 @@ public interface FragmentsRendering extends SmartView {
* @param model attributes for the fragment, in addition to attributes from the
* shared model for the request
* @return the created builder
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragment(String viewName, Map<String, Object> model) {
return new DefaultFragmentsRenderingBuilder().fragment(viewName, model);
@@ -82,13 +82,41 @@ public interface FragmentsRendering extends SmartView {
* @param fragments the fragments to add; each fragment also inherits
* attributes from the shared model for the request
* @return the created builder
* @since 6.2.1
* @since 6.2.13
*/
static Builder fragments(Collection<ModelAndView> fragments) {
return new DefaultFragmentsRenderingBuilder().fragments(fragments);
}
/**
* The same as {@link #fragment(String, Map)}.
* @deprecated in favor of {@link #fragment(String, Map)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder with(String viewName, Map<String, Object> model) {
return fragment(viewName, model);
}
/**
* The same as {@link #fragment(String)}.
* @deprecated in favor of {@link #fragment(String)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder with(String viewName) {
return fragment(viewName);
}
/**
* The same as {@link #fragments(Collection)}.
* @deprecated in favor of {@link #fragments(Collection)}
*/
@Deprecated(since = "6.2.13", forRemoval = true)
static Builder with(Collection<ModelAndView> fragments) {
return fragments(fragments);
}
/**
* Defines a builder for {@link FragmentsRendering}.
*/
@@ -53,8 +53,7 @@ public class DefaultFragmentsRenderingTests {
MockHttpServletRequest request = new MockHttpServletRequest();
MockHttpServletResponse response = new MockHttpServletResponse();
FragmentsRendering view = FragmentsRendering
.fragment("fragment1", Map.of("foo", "Foo"))
FragmentsRendering view = FragmentsRendering.fragment("fragment1", Map.of("foo", "Foo"))
.fragment("fragment2", Map.of("bar", "Bar"))
.header("headerName", "headerValue")
.build();