替换过时常量

master
awenes 1 month ago
parent 946f7d2c17
commit fc8ddca830

@ -18,12 +18,12 @@
package cn.topiam.employee.protocol.form.endpoint;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.compress.utils.CharsetNames;
import org.apache.http.entity.ContentType;
import org.springframework.core.log.LogMessage;
import org.springframework.http.HttpStatus;
@ -207,7 +207,7 @@ public final class FormAuthenticationEndpointFilter extends OncePerRequestFilter
FormAuthenticationToken authenticationToken = (FormAuthenticationToken) authentication;
FormProtocolConfig config = authenticationToken.getConfig();
try {
response.setCharacterEncoding(CharsetNames.UTF_8);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.setContentType(ContentType.TEXT_HTML.getMimeType());
Template template = freemarkerTemplateConfiguration.getTemplate("form_redirect.ftlh");
Map<String, Object> data = new HashMap<>(16);
@ -257,7 +257,7 @@ public final class FormAuthenticationEndpointFilter extends OncePerRequestFilter
freemarkerTemplateConfiguration
.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/template/"));
//编码
freemarkerTemplateConfiguration.setDefaultEncoding(CharsetNames.UTF_8);
freemarkerTemplateConfiguration.setDefaultEncoding(StandardCharsets.UTF_8.name());
//国际化
freemarkerTemplateConfiguration.setLocale(new Locale("zh_CN"));
} catch (Exception exception) {

@ -18,12 +18,12 @@
package cn.topiam.employee.protocol.jwt.endpoint;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.compress.utils.CharsetNames;
import org.apache.http.entity.ContentType;
import org.springframework.core.log.LogMessage;
import org.springframework.lang.NonNull;
@ -200,7 +200,7 @@ public final class JwtLoginAuthenticationEndpointFilter extends OncePerRequestFi
JwtProtocolConfig config = authenticationToken.getConfig();
IdToken idToken = authenticationToken.getIdToken();
String targetUri = Objects.toString(authenticationToken.getTargetUrl(), config.getTargetLinkUrl());
response.setCharacterEncoding(CharsetNames.UTF_8);
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.setContentType(ContentType.TEXT_HTML.getMimeType());
try {
Template template = freemarkerTemplateConfiguration.getTemplate("jwt_redirect.ftlh");
@ -225,7 +225,7 @@ public final class JwtLoginAuthenticationEndpointFilter extends OncePerRequestFi
freemarkerTemplateConfiguration
.setTemplateLoader(new ClassTemplateLoader(this.getClass(), "/template/"));
//编码
freemarkerTemplateConfiguration.setDefaultEncoding(CharsetNames.UTF_8);
freemarkerTemplateConfiguration.setDefaultEncoding(StandardCharsets.UTF_8.name());
//国际化
freemarkerTemplateConfiguration.setLocale(new Locale("zh_CN"));
} catch (Exception exception) {

Loading…
Cancel
Save