From ce53443cf0e00633d604e7d6673bda686749b3ed Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sat, 29 Jun 2024 16:53:26 +0200 Subject: [PATCH] Polishing --- .../web/reactive/result/view/ViewResolverSupport.java | 8 ++++---- .../web/servlet/view/UrlBasedViewResolver.java | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolverSupport.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolverSupport.java index 6d0db61d149..f53e0d97cd5 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolverSupport.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/ViewResolverSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ import org.springframework.util.Assert; public abstract class ViewResolverSupport implements Ordered { /** - * The default {@link MediaType content-type} for views. + * The default {@link MediaType content-type} for views: {@code "text/html;charset=UTF-8"}. */ public static final MediaType DEFAULT_CONTENT_TYPE = MediaType.parseMediaType("text/html;charset=UTF-8"); @@ -54,7 +54,7 @@ public abstract class ViewResolverSupport implements Ordered { /** * Set the supported media types for this view. - * Default is "text/html;charset=UTF-8". + *

Default is {@code "text/html;charset=UTF-8"}. */ public void setSupportedMediaTypes(List supportedMediaTypes) { Assert.notEmpty(supportedMediaTypes, "MediaType List must not be empty"); @@ -72,7 +72,7 @@ public abstract class ViewResolverSupport implements Ordered { /** * Set the default charset for this view, used when the * {@linkplain #setSupportedMediaTypes(List) content type} does not contain one. - * Default is {@linkplain StandardCharsets#UTF_8 UTF 8}. + *

Default is {@linkplain StandardCharsets#UTF_8 UTF-8}. */ public void setDefaultCharset(Charset defaultCharset) { Assert.notNull(defaultCharset, "Default Charset must not be null"); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java index b5ffaaaef88..163b84454ad 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/UrlBasedViewResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -196,9 +196,10 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements } /** - * Set the content type for all views. + * Set the content type for all views — for example, + * {@code "text/html;charset=UTF-8"}. *

May be ignored by view classes if the view itself is assumed - * to set the content type, e.g. in case of JSPs. + * to set the content type — for example, in case of JSPs. */ public void setContentType(@Nullable String contentType) { this.contentType = contentType;