Upgrade to Spring Framework 6 and Jakarta EE 9

Closes gh-28619
Closes gh-28620
Closes gh-28621
Closes gh-28622
Closes gh-28623
Closes gh-28624
Closes gh-28625
Closes gh-28626
Closes gh-28627
Closes gh-28628
Closes gh-28629
Closes gh-28630
Closes gh-28631
Closes gh-28632
Closes gh-28633
Closes gh-28634
Closes gh-28635
Closes gh-28636
Closes gh-28638
Closes gh-28639
Closes gh-28640
Closes gh-28644
Closes gh-28645
Closes gh-28650
Closes gh-28711
Closes gh-28866
Closes gh-28867
Closes gh-28868
Closes gh-28872

See gh-28641
See gh-28642
See gh-28643
See gh-28646
See gh-28647
See gh-28648
See gh-28649
See gh-28721
See gh-28869
See gh-28871
This commit is contained in:
Andy Wilkinson
2021-11-30 20:32:16 +00:00
parent 91b2eb1a6f
commit fe7b13ec46
444 changed files with 1642 additions and 2394 deletions

View File

@@ -35,9 +35,8 @@ dependencies {
optional("io.r2dbc:r2dbc-pool")
optional("io.rsocket:rsocket-core")
optional("io.rsocket:rsocket-transport-netty")
optional("io.undertow:undertow-servlet") {
optional("io.undertow:undertow-servlet-jakartaee9") {
exclude group: "org.jboss.spec.javax.annotation", module: "jboss-annotations-api_1.3_spec"
exclude group: "org.jboss.spec.javax.servlet", module: "jboss-servlet-api_4.0_spec"
}
optional("jakarta.jms:jakarta.jms-api")
optional("jakarta.persistence:jakarta.persistence-api")
@@ -72,12 +71,7 @@ dependencies {
}
optional("org.flywaydb:flyway-core")
optional("org.hamcrest:hamcrest-library")
optional("org.hibernate:hibernate-core") {
exclude(group: "javax.activation", module: "javax.activation-api")
exclude(group: "javax.persistence", module: "javax.persistence-api")
exclude(group: "javax.xml.bind", module: "jaxb-api")
exclude(group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec")
}
optional("org.hibernate:hibernate-core-jakarta")
optional("org.hibernate.validator:hibernate-validator")
optional("org.liquibase:liquibase-core") {
exclude(group: "javax.xml.bind", module: "jaxb-api")
@@ -94,7 +88,13 @@ dependencies {
optional("org.springframework:spring-webflux")
optional("org.springframework:spring-webmvc")
optional("org.springframework.security:spring-security-web")
optional("org.springframework.ws:spring-ws-core")
optional("org.springframework.ws:spring-ws-core") {
exclude group: "com.sun.mail", module: "jakarta.mail"
exclude group: "jakarta.platform", module: "jakarta.jakartaee-api"
exclude group: "org.eclipse.jetty", module: "jetty-server"
exclude group: "org.eclipse.jetty", module: "jetty-servlet"
exclude group: "jakarta.mail", module: "jakarta.mail-api"
}
optional("org.yaml:snakeyaml")
optional("org.jetbrains.kotlin:kotlin-reflect")
optional("org.jetbrains.kotlin:kotlin-stdlib")
@@ -110,7 +110,7 @@ dependencies {
testImplementation("com.sun.xml.messaging.saaj:saaj-impl")
testImplementation("io.projectreactor:reactor-test")
testImplementation("io.r2dbc:r2dbc-h2")
testImplementation("jakarta.persistence:jakarta.persistence-api")
testImplementation("jakarta.inject:jakarta.inject-api")
testImplementation("jakarta.xml.ws:jakarta.xml.ws-api")
testImplementation("mysql:mysql-connector-java")
testImplementation("net.sourceforge.jtds:jtds")

View File

@@ -45,7 +45,7 @@ public enum WebApplicationType {
*/
REACTIVE;
private static final String[] SERVLET_INDICATOR_CLASSES = { "javax.servlet.Servlet",
private static final String[] SERVLET_INDICATOR_CLASSES = { "jakarta.servlet.Servlet",
"org.springframework.web.context.ConfigurableWebApplicationContext" };
private static final String WEBMVC_INDICATOR_CLASS = "org.springframework.web.servlet.DispatcherServlet";

View File

@@ -32,8 +32,8 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
*/
final class ConfigurationPropertiesJsr303Validator implements Validator {
private static final String[] VALIDATOR_CLASSES = { "javax.validation.Validator",
"javax.validation.ValidatorFactory", "javax.validation.bootstrap.GenericBootstrap" };
private static final String[] VALIDATOR_CLASSES = { "jakarta.validation.Validator",
"jakarta.validation.ValidatorFactory", "jakarta.validation.bootstrap.GenericBootstrap" };
private final Delegate delegate;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.diagnostics.analyzer;
import javax.validation.ValidationException;
import jakarta.validation.ValidationException;
import org.springframework.boot.diagnostics.AbstractFailureAnalyzer;
import org.springframework.boot.diagnostics.FailureAnalysis;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,7 +18,8 @@ package org.springframework.boot.jdbc;
import javax.sql.DataSource;
import javax.sql.XADataSource;
import javax.transaction.TransactionManager;
import jakarta.transaction.TransactionManager;
/**
* Strategy interface used to wrap an {@link XADataSource} enrolling it with a JTA

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,9 +16,9 @@
package org.springframework.boot.jms;
import javax.jms.ConnectionFactory;
import javax.jms.XAConnectionFactory;
import javax.transaction.TransactionManager;
import jakarta.jms.ConnectionFactory;
import jakarta.jms.XAConnectionFactory;
import jakarta.transaction.TransactionManager;
/**
* Strategy interface used to wrap a JMS {@link XAConnectionFactory} enrolling it with a

View File

@@ -21,7 +21,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.persistence.EntityManagerFactory;
import jakarta.persistence.EntityManagerFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

View File

@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.EntityManagerFactory;
import jakarta.persistence.EntityManagerFactory;
import org.springframework.boot.sql.init.dependency.AbstractBeansOfTypeDependsOnDatabaseInitializationDetector;
import org.springframework.boot.sql.init.dependency.DependsOnDatabaseInitializationDetector;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,8 +16,8 @@
package org.springframework.boot.orm.jpa.hibernate;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
import jakarta.transaction.TransactionManager;
import jakarta.transaction.UserTransaction;
import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,7 +18,7 @@ package org.springframework.boot.security.servlet;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;

View File

@@ -20,9 +20,9 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.validation.MessageInterpolator;
import javax.validation.Validation;
import javax.validation.ValidationException;
import jakarta.validation.MessageInterpolator;
import jakarta.validation.Validation;
import jakarta.validation.ValidationException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;

View File

@@ -20,7 +20,7 @@ import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Set;
import javax.validation.MessageInterpolator;
import jakarta.validation.MessageInterpolator;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -23,7 +23,7 @@ import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
import javax.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContainerInitializer;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.eclipse.jetty.util.component.AbstractLifeCycle;

View File

@@ -21,9 +21,9 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.server.Request;

View File

@@ -18,9 +18,9 @@ package org.springframework.boot.web.embedded.jetty;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.server.Request;
@@ -46,14 +46,6 @@ final class JettyHandlerWrappers {
for (HttpMethod httpMethod : HttpMethod.values()) {
handler.addIncludedMethods(httpMethod.name());
}
if (compression.getExcludedUserAgents() != null) {
try {
handler.setExcludedAgentPatterns(compression.getExcludedUserAgents());
}
catch (NoSuchMethodError ex) {
// Jetty 10 does not support User-Agent-based exclusions
}
}
return handler;
}

View File

@@ -19,9 +19,9 @@ package org.springframework.boot.web.embedded.jetty;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.nio.channels.ReadableByteChannel;
import java.time.Duration;
@@ -33,11 +33,11 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponseWrapper;
import org.eclipse.jetty.http.HttpCookie;
import org.eclipse.jetty.http.MimeTypes;
@@ -84,7 +84,6 @@ import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
/**
@@ -332,15 +331,7 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
holder.setInitOrder(1);
context.getServletHandler().addServletWithMapping(holder, "/");
ServletMapping servletMapping = context.getServletHandler().getServletMapping("/");
try {
servletMapping.setDefault(true);
}
catch (NoSuchMethodError ex) {
// Jetty 10
Method setFromDefaultDescriptor = ReflectionUtils.findMethod(servletMapping.getClass(),
"setFromDefaultDescriptor", boolean.class);
ReflectionUtils.invokeMethod(setFromDefaultDescriptor, servletMapping, true);
}
servletMapping.setFromDefaultDescriptor(true);
}
/**
@@ -601,9 +592,8 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
}
@Override
@Deprecated
public URL getURL() {
return this.delegate.getURL();
public URI getURI() {
return this.delegate.getURI();
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.embedded.jetty;
import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import org.eclipse.jetty.webapp.AbstractConfiguration;
import org.eclipse.jetty.webapp.Configuration;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,9 +18,7 @@ package org.springframework.boot.web.embedded.tomcat;
import org.apache.catalina.connector.Connector;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.UpgradeProtocol;
import org.apache.coyote.http11.AbstractHttp11Protocol;
import org.apache.coyote.http2.Http2Protocol;
import org.springframework.boot.web.server.Compression;
import org.springframework.util.StringUtils;
@@ -46,21 +44,6 @@ class CompressionConnectorCustomizer implements TomcatConnectorCustomizer {
if (handler instanceof AbstractHttp11Protocol) {
customize((AbstractHttp11Protocol<?>) handler);
}
for (UpgradeProtocol upgradeProtocol : connector.findUpgradeProtocols()) {
if (upgradeProtocol instanceof Http2Protocol) {
customize((Http2Protocol) upgradeProtocol);
}
}
}
}
private void customize(Http2Protocol protocol) {
Compression compression = this.compression;
protocol.setCompression("on");
protocol.setCompressionMinSize(getMinResponseSize(compression));
protocol.setCompressibleMimeType(getMimeTypes(compression));
if (this.compression.getExcludedUserAgents() != null) {
protocol.setNoCompressionUserAgents(getExcludedUserAgents());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -19,11 +19,12 @@ package org.springframework.boot.web.embedded.tomcat;
import java.io.FileNotFoundException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.http11.AbstractHttp11JsseProtocol;
import org.apache.coyote.http11.Http11NioProtocol;
import org.apache.tomcat.util.net.SSLHostConfig;
import org.apache.tomcat.util.net.SSLHostConfigCertificate;
import org.apache.tomcat.util.net.SSLHostConfigCertificate.Type;
import org.springframework.boot.web.server.Ssl;
import org.springframework.boot.web.server.SslStoreProvider;
@@ -67,56 +68,63 @@ class SslConnectorCustomizer implements TomcatConnectorCustomizer {
*/
protected void configureSsl(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl, SslStoreProvider sslStoreProvider) {
protocol.setSSLEnabled(true);
protocol.setSslProtocol(ssl.getProtocol());
configureSslClientAuth(protocol, ssl);
SSLHostConfig sslHostConfig = new SSLHostConfig();
sslHostConfig.setHostName(protocol.getDefaultSSLHostConfigName());
sslHostConfig.setSslProtocol(ssl.getProtocol());
protocol.addSslHostConfig(sslHostConfig);
configureSslClientAuth(sslHostConfig, ssl);
SSLHostConfigCertificate certificate = new SSLHostConfigCertificate(sslHostConfig, Type.UNDEFINED);
if (ssl.getKeyStorePassword() != null) {
protocol.setKeystorePass(ssl.getKeyStorePassword());
certificate.setCertificateKeystorePassword(ssl.getKeyStorePassword());
}
if (ssl.getKeyPassword() != null) {
protocol.setKeyPass(ssl.getKeyPassword());
certificate.setCertificateKeyPassword(ssl.getKeyPassword());
}
protocol.setKeyAlias(ssl.getKeyAlias());
if (ssl.getKeyAlias() != null) {
certificate.setCertificateKeyAlias(ssl.getKeyAlias());
}
sslHostConfig.addCertificate(certificate);
String ciphers = StringUtils.arrayToCommaDelimitedString(ssl.getCiphers());
if (StringUtils.hasText(ciphers)) {
protocol.setCiphers(ciphers);
sslHostConfig.setCiphers(ciphers);
}
configureEnabledProtocols(protocol, ssl);
if (sslStoreProvider != null) {
configureSslStoreProvider(protocol, sslHostConfig, certificate, sslStoreProvider);
}
else {
configureSslKeyStore(certificate, ssl);
configureSslTrustStore(sslHostConfig, ssl);
}
}
private void configureEnabledProtocols(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
if (ssl.getEnabledProtocols() != null) {
for (SSLHostConfig sslHostConfig : protocol.findSslHostConfigs()) {
sslHostConfig.setProtocols(StringUtils.arrayToCommaDelimitedString(ssl.getEnabledProtocols()));
}
}
if (sslStoreProvider != null) {
configureSslStoreProvider(protocol, sslStoreProvider);
}
else {
configureSslKeyStore(protocol, ssl);
configureSslTrustStore(protocol, ssl);
}
}
private void configureSslClientAuth(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
private void configureSslClientAuth(SSLHostConfig config, Ssl ssl) {
if (ssl.getClientAuth() == Ssl.ClientAuth.NEED) {
protocol.setClientAuth(Boolean.TRUE.toString());
config.setCertificateVerification("required");
}
else if (ssl.getClientAuth() == Ssl.ClientAuth.WANT) {
protocol.setClientAuth("want");
config.setCertificateVerification("optional");
}
}
protected void configureSslStoreProvider(AbstractHttp11JsseProtocol<?> protocol,
SslStoreProvider sslStoreProvider) {
protected void configureSslStoreProvider(AbstractHttp11JsseProtocol<?> protocol, SSLHostConfig sslHostConfig,
SSLHostConfigCertificate certificate, SslStoreProvider sslStoreProvider) {
Assert.isInstanceOf(Http11NioProtocol.class, protocol,
"SslStoreProvider can only be used with Http11NioProtocol");
TomcatURLStreamHandlerFactory instance = TomcatURLStreamHandlerFactory.getInstance();
instance.addUserFactory(new SslStoreProviderUrlStreamHandlerFactory(sslStoreProvider));
try {
if (sslStoreProvider.getKeyStore() != null) {
protocol.setKeystorePass("");
protocol.setKeystoreFile(SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
certificate.setCertificateKeystore(sslStoreProvider.getKeyStore());
}
if (sslStoreProvider.getTrustStore() != null) {
protocol.setTruststorePass("");
protocol.setTruststoreFile(SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL);
sslHostConfig.setTrustStore(sslStoreProvider.getTrustStore());
}
}
catch (Exception ex) {
@@ -124,38 +132,38 @@ class SslConnectorCustomizer implements TomcatConnectorCustomizer {
}
}
private void configureSslKeyStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
private void configureSslKeyStore(SSLHostConfigCertificate certificate, Ssl ssl) {
try {
protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString());
certificate.setCertificateKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString());
}
catch (Exception ex) {
throw new WebServerException("Could not load key store '" + ssl.getKeyStore() + "'", ex);
}
if (ssl.getKeyStoreType() != null) {
protocol.setKeystoreType(ssl.getKeyStoreType());
certificate.setCertificateKeystoreType(ssl.getKeyStoreType());
}
if (ssl.getKeyStoreProvider() != null) {
protocol.setKeystoreProvider(ssl.getKeyStoreProvider());
certificate.setCertificateKeystoreProvider(ssl.getKeyStoreProvider());
}
}
private void configureSslTrustStore(AbstractHttp11JsseProtocol<?> protocol, Ssl ssl) {
private void configureSslTrustStore(SSLHostConfig sslHostConfig, Ssl ssl) {
if (ssl.getTrustStore() != null) {
try {
protocol.setTruststoreFile(ResourceUtils.getURL(ssl.getTrustStore()).toString());
sslHostConfig.setTruststoreFile(ResourceUtils.getURL(ssl.getTrustStore()).toString());
}
catch (FileNotFoundException ex) {
throw new WebServerException("Could not load trust store: " + ex.getMessage(), ex);
}
}
if (ssl.getTrustStorePassword() != null) {
protocol.setTruststorePass(ssl.getTrustStorePassword());
sslHostConfig.setTruststorePassword(ssl.getTrustStorePassword());
}
if (ssl.getTrustStoreType() != null) {
protocol.setTruststoreType(ssl.getTrustStoreType());
sslHostConfig.setTruststoreType(ssl.getTrustStoreType());
}
if (ssl.getTrustStoreProvider() != null) {
protocol.setTruststoreProvider(ssl.getTrustStoreProvider());
sslHostConfig.setTruststoreProvider(ssl.getTrustStoreProvider());
}
}

View File

@@ -1,111 +0,0 @@
/*
* Copyright 2012-2019 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.web.embedded.tomcat;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
import java.security.KeyStore;
import org.springframework.boot.web.server.SslStoreProvider;
/**
* A {@link URLStreamHandlerFactory} that provides a {@link URLStreamHandler} for
* accessing an {@link SslStoreProvider}'s key store and trust store from a URL.
*
* @author Andy Wilkinson
*/
class SslStoreProviderUrlStreamHandlerFactory implements URLStreamHandlerFactory {
private static final String PROTOCOL = "springbootssl";
private static final String KEY_STORE_PATH = "keyStore";
static final String KEY_STORE_URL = PROTOCOL + ":" + KEY_STORE_PATH;
private static final String TRUST_STORE_PATH = "trustStore";
static final String TRUST_STORE_URL = PROTOCOL + ":" + TRUST_STORE_PATH;
private final SslStoreProvider sslStoreProvider;
SslStoreProviderUrlStreamHandlerFactory(SslStoreProvider sslStoreProvider) {
this.sslStoreProvider = sslStoreProvider;
}
@Override
public URLStreamHandler createURLStreamHandler(String protocol) {
if (PROTOCOL.equals(protocol)) {
return new URLStreamHandler() {
@Override
protected URLConnection openConnection(URL url) throws IOException {
try {
if (KEY_STORE_PATH.equals(url.getPath())) {
return new KeyStoreUrlConnection(url,
SslStoreProviderUrlStreamHandlerFactory.this.sslStoreProvider.getKeyStore());
}
if (TRUST_STORE_PATH.equals(url.getPath())) {
return new KeyStoreUrlConnection(url,
SslStoreProviderUrlStreamHandlerFactory.this.sslStoreProvider.getTrustStore());
}
}
catch (Exception ex) {
throw new IOException(ex);
}
throw new IOException("Invalid path: " + url.getPath());
}
};
}
return null;
}
private static final class KeyStoreUrlConnection extends URLConnection {
private final KeyStore keyStore;
private KeyStoreUrlConnection(URL url, KeyStore keyStore) {
super(url);
this.keyStore = keyStore;
}
@Override
public void connect() throws IOException {
}
@Override
public InputStream getInputStream() throws IOException {
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
this.keyStore.store(stream, new char[0]);
return new ByteArrayInputStream(stream.toByteArray());
}
catch (Exception ex) {
throw new IOException(ex);
}
}
}
}

View File

@@ -72,6 +72,7 @@ final class TldPatterns {
skipPatterns.add("hibernate*.jar");
skipPatterns.add("httpclient*.jar");
skipPatterns.add("icu4j-*.jar");
skipPatterns.add("jakartaee-migration-*.jar");
skipPatterns.add("jasper-el.jar");
skipPatterns.add("jasper.jar");
skipPatterns.add("jaspic-api.jar");

View File

@@ -22,7 +22,7 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Stream;
import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import org.apache.catalina.Container;
import org.apache.catalina.LifecycleException;

View File

@@ -33,9 +33,9 @@ import java.util.Locale;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,9 +18,9 @@ package org.springframework.boot.web.embedded.tomcat;
import java.util.Set;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -19,7 +19,7 @@ package org.springframework.boot.web.embedded.undertow;
import java.io.Closeable;
import java.io.IOException;
import javax.servlet.ServletException;
import jakarta.servlet.ServletException;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;

View File

@@ -34,9 +34,9 @@ import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import io.undertow.Undertow.Builder;
import io.undertow.server.HttpHandler;
@@ -640,9 +640,9 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
}
}
private javax.servlet.http.Cookie asServletCookie(Cookie cookie) {
private jakarta.servlet.http.Cookie asServletCookie(Cookie cookie) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
javax.servlet.http.Cookie result = new javax.servlet.http.Cookie(cookie.getName(), cookie.getValue());
jakarta.servlet.http.Cookie result = new jakarta.servlet.http.Cookie(cookie.getName(), cookie.getValue());
map.from(cookie::getComment).to(result::setComment);
map.from(cookie::getDomain).to(result::setDomain);
map.from(cookie::getMaxAge).to(result::setMaxAge);
@@ -653,7 +653,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac
return result;
}
private SameSite getSameSite(javax.servlet.http.Cookie cookie) {
private SameSite getSameSite(jakarta.servlet.http.Cookie cookie) {
for (CookieSameSiteSupplier supplier : this.suppliers) {
SameSite sameSite = supplier.getSameSite(cookie);
if (sameSite != null) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -23,11 +23,11 @@ import java.util.EnumSet;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.FilterRegistration.Dynamic;
import javax.servlet.ServletContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.FilterRegistration.Dynamic;
import jakarta.servlet.ServletContext;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

View File

@@ -16,9 +16,9 @@
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.Filter;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,7 +18,7 @@ package org.springframework.boot.web.servlet;
/**
* Enumeration of filter dispatcher types, identical to
* {@link javax.servlet.DispatcherType} and used in configuration as the servlet API may
* {@link jakarta.servlet.DispatcherType} and used in configuration as the servlet API may
* not be present.
*
* @author Stephane Nicoll

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -19,8 +19,8 @@ package org.springframework.boot.web.servlet;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.Registration;
import javax.servlet.ServletContext;
import jakarta.servlet.Registration;
import jakarta.servlet.ServletContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
* Base class for Servlet 3.0+ {@link javax.servlet.Registration.Dynamic dynamic} based
* Base class for Servlet 3.0+ {@link jakarta.servlet.Registration.Dynamic dynamic} based
* registration beans.
*
* @param <D> the dynamic registration result

View File

@@ -16,8 +16,8 @@
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import javax.servlet.ServletContext;
import jakarta.servlet.Filter;
import jakarta.servlet.ServletContext;
import org.springframework.util.Assert;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet;
import javax.servlet.MultipartConfigElement;
import jakarta.servlet.MultipartConfigElement;
import org.springframework.util.unit.DataSize;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,8 +16,8 @@
package org.springframework.boot.web.servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -22,9 +22,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebListener;
import javax.servlet.annotation.WebServlet;
import jakarta.servlet.annotation.WebFilter;
import jakarta.servlet.annotation.WebListener;
import jakarta.servlet.annotation.WebServlet;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,9 +16,9 @@
package org.springframework.boot.web.servlet;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.ServletContainerInitializer;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import org.springframework.web.SpringServletContainerInitializer;
import org.springframework.web.WebApplicationInitializer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -30,9 +30,9 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.Filter;
import javax.servlet.MultipartConfigElement;
import javax.servlet.Servlet;
import jakarta.servlet.Filter;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.Servlet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -21,14 +21,14 @@ import java.util.EventListener;
import java.util.HashSet;
import java.util.Set;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionIdListener;
import javax.servlet.http.HttpSessionListener;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextAttributeListener;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.ServletRequestAttributeListener;
import jakarta.servlet.ServletRequestListener;
import jakarta.servlet.http.HttpSessionAttributeListener;
import jakarta.servlet.http.HttpSessionIdListener;
import jakarta.servlet.http.HttpSessionListener;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -21,10 +21,10 @@ import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.servlet.MultipartConfigElement;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletRegistration;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -20,8 +20,8 @@ import java.util.Arrays;
import java.util.EnumSet;
import java.util.Map;
import javax.servlet.DispatcherType;
import javax.servlet.annotation.WebFilter;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.annotation.WebFilter;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,7 +18,7 @@ package org.springframework.boot.web.servlet;
import java.util.Map;
import javax.servlet.annotation.WebListener;
import jakarta.servlet.annotation.WebListener;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet;
import javax.servlet.annotation.WebListener;
import jakarta.servlet.annotation.WebListener;
/**
* Interface to be implemented by types that register {@link WebListener @WebListeners}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet;
import javax.servlet.annotation.WebListener;
import jakarta.servlet.annotation.WebListener;
/**
* A registry that holds {@link WebListener @WebListeners}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,9 +18,9 @@ package org.springframework.boot.web.servlet;
import java.util.Map;
import javax.servlet.MultipartConfigElement;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.annotation.MultipartConfig;
import jakarta.servlet.annotation.WebServlet;
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;

View File

@@ -24,11 +24,11 @@ import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import jakarta.servlet.Filter;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,8 +16,8 @@
package org.springframework.boot.web.servlet.context;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletContext;
import org.springframework.util.Assert;
import org.springframework.web.context.ConfigurableWebApplicationContext;

View File

@@ -22,10 +22,10 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.boot.web.error.ErrorAttributeOptions;
import org.springframework.boot.web.error.ErrorAttributeOptions.Include;

View File

@@ -35,7 +35,7 @@ import org.springframework.web.servlet.ModelAndView;
public interface ErrorAttributes {
/**
* Name of the {@link javax.servlet.http.HttpServletRequest#getAttribute(String)
* Name of the {@link jakarta.servlet.http.HttpServletRequest#getAttribute(String)
* request attribute} holding the error resolved by the {@code ErrorAttributes}
* implementation.
* @since 2.5.0

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,10 +18,10 @@ package org.springframework.boot.web.servlet.filter;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.context.ApplicationContext;
import org.springframework.web.filter.OncePerRequestFilter;

View File

@@ -18,15 +18,15 @@ package org.springframework.boot.web.servlet.filter;
import java.io.IOException;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,12 +16,12 @@
package org.springframework.boot.web.servlet.filter;
import javax.servlet.Filter;
import jakarta.servlet.Filter;
import org.springframework.core.Ordered;
/**
* An {@link Ordered} {@link javax.servlet.Filter}.
* An {@link Ordered} {@link jakarta.servlet.Filter}.
*
* @author Phillip Webb
* @since 2.1.0

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -15,6 +15,6 @@
*/
/**
* Spring Boot specific {@link javax.servlet.Filter} implementations.
* Spring Boot specific {@link jakarta.servlet.Filter} implementations.
*/
package org.springframework.boot.web.servlet.filter;

View File

@@ -15,6 +15,6 @@
*/
/**
* Classes and utilities designed to work with the {@code javax.servlet} specification.
* Classes and utilities designed to work with the {@code jakarta.servlet} specification.
*/
package org.springframework.boot.web.servlet;

View File

@@ -31,9 +31,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.SessionCookieConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.SessionCookieConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -347,13 +347,13 @@ public abstract class AbstractServletWebServerFactory extends AbstractConfigurab
map.from(cookie::getMaxAge).asInt(Duration::getSeconds).to(config::setMaxAge);
}
private Set<javax.servlet.SessionTrackingMode> unwrap(Set<Session.SessionTrackingMode> modes) {
private Set<jakarta.servlet.SessionTrackingMode> unwrap(Set<Session.SessionTrackingMode> modes) {
if (modes == null) {
return null;
}
Set<javax.servlet.SessionTrackingMode> result = new LinkedHashSet<>();
Set<jakarta.servlet.SessionTrackingMode> result = new LinkedHashSet<>();
for (Session.SessionTrackingMode mode : modes) {
result.add(javax.servlet.SessionTrackingMode.valueOf(mode.name()));
result.add(jakarta.servlet.SessionTrackingMode.valueOf(mode.name()));
}
return result;
}

View File

@@ -22,7 +22,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.servlet.ServletContext;
import jakarta.servlet.ServletContext;
import org.springframework.boot.web.server.ConfigurableWebServerFactory;
import org.springframework.boot.web.server.Cookie.SameSite;

View File

@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
/**
* @author Phillip Webb
*/
import javax.servlet.http.Cookie;
import jakarta.servlet.http.Cookie;
import org.springframework.boot.web.server.Cookie.SameSite;
import org.springframework.util.Assert;

View File

@@ -126,7 +126,7 @@ public class Session {
/**
* Available session tracking modes (mirrors
* {@link javax.servlet.SessionTrackingMode}.
* {@link jakarta.servlet.SessionTrackingMode}.
*/
public enum SessionTrackingMode {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -25,16 +25,16 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponseWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -67,18 +67,18 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry, Ordered {
// From RequestDispatcher but not referenced to remain compatible with Servlet 2.5
private static final String ERROR_EXCEPTION = "javax.servlet.error.exception";
private static final String ERROR_EXCEPTION = "jakarta.servlet.error.exception";
private static final String ERROR_EXCEPTION_TYPE = "javax.servlet.error.exception_type";
private static final String ERROR_EXCEPTION_TYPE = "jakarta.servlet.error.exception_type";
private static final String ERROR_MESSAGE = "javax.servlet.error.message";
private static final String ERROR_MESSAGE = "jakarta.servlet.error.message";
/**
* The name of the servlet attribute containing request URI.
*/
public static final String ERROR_REQUEST_URI = "javax.servlet.error.request_uri";
public static final String ERROR_REQUEST_URI = "jakarta.servlet.error.request_uri";
private static final String ERROR_STATUS_CODE = "javax.servlet.error.status_code";
private static final String ERROR_STATUS_CODE = "jakarta.servlet.error.status_code";
private static final Set<Class<?>> CLIENT_ABORT_EXCEPTIONS;
static {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet.support;
import javax.servlet.DispatcherType;
import jakarta.servlet.DispatcherType;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet.support;
import javax.servlet.ServletContext;
import jakarta.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextInitializer;

View File

@@ -21,11 +21,11 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Collections;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletException;
import jakarta.servlet.Filter;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -198,7 +198,7 @@ public abstract class SpringBootServletInitializer implements WebApplicationInit
/**
* {@link ApplicationListener} to trigger
* {@link ConfigurableWebEnvironment#initPropertySources(ServletContext, javax.servlet.ServletConfig)}.
* {@link ConfigurableWebEnvironment#initPropertySources(ServletContext, jakarta.servlet.ServletConfig)}.
*/
private static final class WebEnvironmentPropertySourceInitializer
implements ApplicationListener<ApplicationEnvironmentPreparedEvent>, Ordered {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -22,8 +22,8 @@ import java.io.Reader;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import com.samskivert.mustache.Mustache.Compiler;
import com.samskivert.mustache.Template;

View File

@@ -33,9 +33,10 @@ import java.util.Properties;
import java.util.Set;
import javax.annotation.PostConstruct;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

View File

@@ -24,7 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.validation.Validation;
import jakarta.validation.Validation;
import org.junit.jupiter.api.Test;
import org.mockito.Answers;

View File

@@ -22,9 +22,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

View File

@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.validation.constraints.Min;
import jakarta.validation.constraints.Min;
import org.junit.jupiter.api.Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -20,9 +20,9 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

View File

@@ -1,79 +0,0 @@
/*
* Copyright 2012-2020 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.diagnostics.analyzer;
import org.junit.jupiter.api.Test;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.validation.annotation.Validated;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* Tests for {@link ValidationExceptionFailureAnalyzer}
*
* @author Andy Wilkinson
*/
@ClassPathExclusions("hibernate-validator-*.jar")
@ClassPathOverrides("javax.validation:validation-api:2.0.1.Final")
class JavaxApiValidationExceptionFailureAnalyzerTests {
@Test
void validatedPropertiesTest() {
assertThatExceptionOfType(Exception.class)
.isThrownBy(() -> new AnnotationConfigApplicationContext(TestConfiguration.class).close())
.satisfies((ex) -> assertThat(new ValidationExceptionFailureAnalyzer().analyze(ex)).isNotNull());
}
@Test
void nonValidatedPropertiesTest() {
new AnnotationConfigApplicationContext(NonValidatedTestConfiguration.class).close();
}
@EnableConfigurationProperties(TestProperties.class)
static class TestConfiguration {
TestConfiguration(TestProperties testProperties) {
}
}
@ConfigurationProperties("test")
@Validated
static class TestProperties {
}
@EnableConfigurationProperties(NonValidatedTestProperties.class)
static class NonValidatedTestConfiguration {
NonValidatedTestConfiguration(NonValidatedTestProperties testProperties) {
}
}
@ConfigurationProperties("test")
static class NonValidatedTestProperties {
}
}

View File

@@ -18,9 +18,6 @@ package org.springframework.boot.diagnostics.analyzer;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServlet;
import org.junit.jupiter.api.Test;
import org.springframework.boot.diagnostics.FailureAnalysis;
@@ -28,9 +25,9 @@ import org.springframework.boot.diagnostics.analyzer.NoSuchMethodFailureAnalyzer
import org.springframework.boot.diagnostics.analyzer.NoSuchMethodFailureAnalyzer.NoSuchMethodDescriptor;
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
import org.springframework.data.r2dbc.mapping.R2dbcMappingContext;
import org.springframework.util.MimeType;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
/**
* Tests for {@link NoSuchMethodFailureAnalyzer}.
@@ -39,70 +36,38 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
* @author Scott Frederick
*/
@ClassPathOverrides({ "javax.servlet:servlet-api:2.5",
@ClassPathOverrides({ "org.springframework:spring-core:5.3.12",
"org.springframework.data:spring-data-relational:1.1.7.RELEASE" })
class NoSuchMethodFailureAnalyzerTests {
@Test
void parseJava8ErrorMessage() {
void parseHotspotErrorMessage() {
NoSuchMethodDescriptor descriptor = new NoSuchMethodFailureAnalyzer().getNoSuchMethodDescriptor(
"javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)"
+ "Ljavax/servlet/ServletRegistration$Dynamic;");
"'boolean org.springframework.util.MimeType.isMoreSpecific(org.springframework.util.MimeType)'");
assertThat(descriptor).isNotNull();
assertThat(descriptor.getErrorMessage())
.isEqualTo("javax.servlet.ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)"
+ "Ljavax/servlet/ServletRegistration$Dynamic;");
assertThat(descriptor.getClassName()).isEqualTo("javax.servlet.ServletContext");
assertThat(descriptor.getErrorMessage()).isEqualTo(
"'boolean org.springframework.util.MimeType.isMoreSpecific(org.springframework.util.MimeType)'");
assertThat(descriptor.getClassName()).isEqualTo("org.springframework.util.MimeType");
assertThat(descriptor.getCandidateLocations().size()).isGreaterThan(1);
List<ClassDescriptor> typeHierarchy = descriptor.getTypeHierarchy();
assertThat(typeHierarchy).hasSize(1);
assertThat(typeHierarchy.get(0).getLocation()).asString().contains("servlet-api-2.5.jar");
assertThat(typeHierarchy.get(0).getLocation()).asString().contains("spring-core-5.3.12.jar");
}
@Test
void parseJavaOpenJ9ErrorMessage() {
NoSuchMethodDescriptor descriptor = new NoSuchMethodFailureAnalyzer().getNoSuchMethodDescriptor(
"javax/servlet/ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)"
+ "Ljavax/servlet/ServletRegistration$Dynamic; (loaded from file...");
assertThat(descriptor).isNotNull();
assertThat(descriptor.getErrorMessage())
.isEqualTo("javax/servlet/ServletContext.addServlet(Ljava/lang/String;Ljavax/servlet/Servlet;)"
+ "Ljavax/servlet/ServletRegistration$Dynamic;");
assertThat(descriptor.getClassName()).isEqualTo("javax.servlet.ServletContext");
assertThat(descriptor.getCandidateLocations().size()).isGreaterThan(1);
List<ClassDescriptor> typeHierarchy = descriptor.getTypeHierarchy();
assertThat(typeHierarchy).hasSize(1);
assertThat(typeHierarchy.get(0).getLocation()).asString().contains("servlet-api-2.5.jar");
}
@Test
void parseJavaImprovedHotspotErrorMessage() {
NoSuchMethodDescriptor descriptor = new NoSuchMethodFailureAnalyzer().getNoSuchMethodDescriptor(
"'javax.servlet.ServletRegistration$Dynamic javax.servlet.ServletContext.addServlet("
+ "java.lang.String, javax.servlet.Servlet)'");
assertThat(descriptor).isNotNull();
assertThat(descriptor.getErrorMessage())
.isEqualTo("'javax.servlet.ServletRegistration$Dynamic javax.servlet.ServletContext.addServlet("
+ "java.lang.String, javax.servlet.Servlet)'");
assertThat(descriptor.getClassName()).isEqualTo("javax.servlet.ServletContext");
assertThat(descriptor.getCandidateLocations().size()).isGreaterThan(1);
List<ClassDescriptor> typeHierarchy = descriptor.getTypeHierarchy();
assertThat(typeHierarchy).hasSize(1);
assertThat(typeHierarchy.get(0).getLocation()).asString().contains("servlet-api-2.5.jar");
}
@Test
void whenAMethodOnAnInterfaceIsMissingThenNoSuchMethodErrorIsAnalyzed() {
Throwable failure = createFailure();
void whenAMethodOnAClassIsMissingThenNoSuchMethodErrorIsAnalyzed() {
Throwable failure = createFailureForMissingMethod();
assertThat(failure).isNotNull();
failure.printStackTrace();
FailureAnalysis analysis = new NoSuchMethodFailureAnalyzer().analyze(failure);
assertThat(analysis).isNotNull();
assertThat(analysis.getDescription())
.contains(NoSuchMethodFailureAnalyzerTests.class.getName() + ".createFailure(").contains("addServlet(")
.contains(NoSuchMethodFailureAnalyzerTests.class.getName() + ".createFailureForMissingMethod(")
.contains("isMoreSpecific(")
.contains("calling method's class, " + NoSuchMethodFailureAnalyzerTests.class.getName() + ",")
.contains("called method's class, javax.servlet.ServletContext,");
.contains("called method's class, org.springframework.util.MimeType,");
assertThat(analysis.getAction()).contains(NoSuchMethodFailureAnalyzerTests.class.getName())
.contains("javax.servlet.ServletContext");
.contains("org.springframework.util.MimeType");
}
@Test
@@ -121,11 +86,11 @@ class NoSuchMethodFailureAnalyzerTests {
assertThat(analysis.getAction()).contains("org.springframework.data.r2dbc.mapping.R2dbcMappingContext");
}
private Throwable createFailure() {
private Throwable createFailureForMissingMethod() {
try {
ServletContext servletContext = mock(ServletContext.class);
servletContext.addServlet("example", new HttpServlet() {
});
System.out.println(MimeType.class.getProtectionDomain().getCodeSource().getLocation());
MimeType mimeType = new MimeType("application", "json");
System.out.println(mimeType.isMoreSpecific(null));
return null;
}
catch (Throwable ex) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,9 +16,9 @@
package org.springframework.boot.orm.jpa.hibernate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
/**
* Simple entity used in {@link SpringPhysicalNamingStrategyTests}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.sampleconfig;
import javax.inject.Named;
import jakarta.inject.Named;
@Named
public class MyNamedComponent {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -22,7 +22,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.junit.jupiter.api.Test;

View File

@@ -16,7 +16,7 @@
package org.springframework.boot.validation;
import javax.validation.MessageInterpolator;
import jakarta.validation.MessageInterpolator;
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
import org.junit.jupiter.api.Test;

View File

@@ -16,9 +16,9 @@
package org.springframework.boot.validation;
import javax.validation.MessageInterpolator;
import javax.validation.Validation;
import javax.validation.ValidationException;
import jakarta.validation.MessageInterpolator;
import jakarta.validation.Validation;
import jakarta.validation.ValidationException;
import org.hibernate.validator.messageinterpolation.ParameterMessageInterpolator;
import org.junit.jupiter.api.Test;
@@ -44,7 +44,7 @@ class MessageInterpolatorFactoryWithoutElIntegrationTests {
// Sanity test
assertThatExceptionOfType(ValidationException.class)
.isThrownBy(Validation.byDefaultProvider().configure()::getDefaultMessageInterpolator)
.withMessageContaining("javax.el.ExpressionFactory");
.withMessageContaining("jakarta.el.ExpressionFactory");
}
@Test

View File

@@ -22,9 +22,9 @@ import java.util.Locale;
import java.util.Set;
import java.util.function.Supplier;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import javax.validation.constraints.NotNull;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import jakarta.validation.constraints.NotNull;
import org.junit.jupiter.api.Test;
@@ -130,8 +130,8 @@ class MessageSourceMessageInterpolatorIntegrationTests {
private static Validator buildValidator() {
Locale locale = LocaleContextHolder.getLocale();
StaticMessageSource messageSource = new StaticMessageSource();
messageSource.addMessage("blank", locale, "{null} or {javax.validation.constraints.NotBlank.message}");
messageSource.addMessage("null", locale, "{javax.validation.constraints.NotNull.message}");
messageSource.addMessage("blank", locale, "{null} or {jakarta.validation.constraints.NotBlank.message}");
messageSource.addMessage("null", locale, "{jakarta.validation.constraints.NotNull.message}");
messageSource.addMessage("recursion", locale, "{middle}");
messageSource.addMessage("middle", locale, "{recursion}");
MessageInterpolatorFactory messageInterpolatorFactory = new MessageInterpolatorFactory(messageSource);

View File

@@ -18,8 +18,8 @@ package org.springframework.boot.validation;
import java.util.Locale;
import javax.validation.MessageInterpolator;
import javax.validation.MessageInterpolator.Context;
import jakarta.validation.MessageInterpolator;
import jakarta.validation.MessageInterpolator.Context;
import org.junit.jupiter.api.Test;

View File

@@ -1,46 +0,0 @@
/*
* Copyright 2012-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.web.embedded.jetty;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link JettyReactiveWebServerFactory} with Jetty 10.
*
* @author Andy Wilkinson
*/
@TestWithJetty10
class Jetty10ReactiveWebServerFactoryTests extends JettyReactiveWebServerFactoryTests {
@Test
void correctVersionOfJettyUsed() {
String jettyVersion = ErrorHandler.class.getPackage().getImplementationVersion();
assertThat(jettyVersion).startsWith("10.0");
}
@Test
@Override
@Disabled("Jetty 10 does not support User-Agent-based compression")
protected void noCompressionForUserAgent() {
}
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright 2012-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.web.embedded.jetty;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link JettyServletWebServerFactory} with Jetty 10.
*
* @author Andy Wilkinson
*/
@TestWithJetty10
class Jetty10ServletWebServerFactoryTests extends JettyServletWebServerFactoryTests {
@Test
@Override
protected void correctVersionOfJettyUsed() {
String jettyVersion = ErrorHandler.class.getPackage().getImplementationVersion();
assertThat(jettyVersion).startsWith("10.0");
}
@Test
@Override
@Disabled("Jetty 10 does not support User-Agent-based compression")
protected void noCompressionForUserAgent() {
}
@Test
@Override
@Disabled("Jetty 10 adds methods to Configuration that we can't mock while compiling against 9")
protected void jettyConfigurations() {
}
}

View File

@@ -25,6 +25,7 @@ import org.awaitility.Awaitility;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.InOrder;
@@ -53,6 +54,13 @@ class JettyReactiveWebServerFactoryTests extends AbstractReactiveWebServerFactor
return new JettyReactiveWebServerFactory(0);
}
@Test
@Override
@Disabled("Jetty 11 does not support User-Agent-based compression")
protected void noCompressionForUserAgent() {
}
@Test
void setNullServerCustomizersShouldThrowException() {
JettyReactiveWebServerFactory factory = getFactory();

View File

@@ -29,12 +29,10 @@ import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRegistration.Dynamic;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.ServletRegistration.Dynamic;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
@@ -48,7 +46,6 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ErrorHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
@@ -57,8 +54,10 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ThreadPool;
import org.eclipse.jetty.webapp.AbstractConfiguration;
import org.eclipse.jetty.webapp.ClassMatcher;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.mockito.InOrder;
@@ -76,6 +75,7 @@ import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
@@ -139,6 +139,13 @@ class JettyServletWebServerFactoryTests extends AbstractServletWebServerFactoryT
handleExceptionCausedByBlockedPortOnPrimaryConnector(ex, blockedPort);
}
@Test
@Override
@Disabled("Jetty 11 does not support User-Agent-based compression")
protected void noCompressionForUserAgent() {
}
@Test
void contextPathIsLoggedOnStartupWhenCompressionIsEnabled(CapturedOutput output) {
AbstractServletWebServerFactory factory = getFactory();
@@ -152,18 +159,11 @@ class JettyServletWebServerFactoryTests extends AbstractServletWebServerFactoryT
}
@Test
protected void correctVersionOfJettyUsed() {
String jettyVersion = ErrorHandler.class.getPackage().getImplementationVersion();
Matcher matcher = Pattern.compile("[0-9]+.[0-9]+.([0-9]+)[\\.-].*").matcher(jettyVersion);
assertThat(matcher.find()).isTrue();
assertThat(Integer.valueOf(matcher.group(1))).isGreaterThan(19);
}
@Test
protected void jettyConfigurations() throws Exception {
void jettyConfigurations() throws Exception {
JettyServletWebServerFactory factory = getFactory();
Configuration[] configurations = new Configuration[4];
Arrays.setAll(configurations, (i) -> mock(Configuration.class));
Configuration[] configurations = new Configuration[] { mockConfiguration(Configuration1.class),
mockConfiguration(Configuration2.class), mockConfiguration(Configuration3.class),
mockConfiguration(Configuration4.class) };
factory.setConfigurations(Arrays.asList(configurations[0], configurations[1]));
factory.addConfigurations(configurations[2], configurations[3]);
this.webServer = factory.getWebServer();
@@ -173,6 +173,14 @@ class JettyServletWebServerFactoryTests extends AbstractServletWebServerFactoryT
}
}
Configuration mockConfiguration(Class<? extends Configuration> type) {
Configuration mock = mock(type);
ClassMatcher classMatcher = new ClassMatcher();
given(mock.getSystemClasses()).willReturn(classMatcher);
given(mock.getServerClasses()).willReturn(classMatcher);
return mock;
}
@Test
void jettyCustomizations() {
JettyServletWebServerFactory factory = getFactory();
@@ -527,4 +535,20 @@ class JettyServletWebServerFactoryTests extends AbstractServletWebServerFactoryT
}
interface Configuration1 extends Configuration {
}
interface Configuration2 extends Configuration {
}
interface Configuration3 extends Configuration {
}
interface Configuration4 extends Configuration {
}
}

View File

@@ -1,47 +0,0 @@
/*
* Copyright 2012-2021 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.web.embedded.jetty;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.JRE;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
import org.springframework.boot.testsupport.classpath.ClassPathOverrides;
/**
* Configure a test class to run its tests with Jetty 10 on the classpath.
*
* @author Andy Wilkinson
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@EnabledForJreRange(min = JRE.JAVA_11)
@ClassPathExclusions({ "jetty-*.jar", "tomcat-embed*.jar", "http2-*.jar" })
@ClassPathOverrides({ "org.slf4j:slf4j-api:1.7.25", "org.eclipse.jetty:jetty-client:10.0.2",
"org.eclipse.jetty:jetty-io:10.0.2", "org.eclipse.jetty:jetty-server:10.0.2",
"org.eclipse.jetty:jetty-servlet:10.0.2", "org.eclipse.jetty:jetty-util:10.0.2",
"org.eclipse.jetty:jetty-webapp:10.0.2", "org.eclipse.jetty.http2:http2-common:10.0.2",
"org.eclipse.jetty.http2:http2-hpack:10.0.2", "org.eclipse.jetty.http2:http2-http-client-transport:10.0.2",
"org.eclipse.jetty.http2:http2-server:10.0.2", "org.mortbay.jasper:apache-jsp:8.5.40" })
@interface TestWithJetty10 {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,6 +16,7 @@
package org.springframework.boot.web.embedded.tomcat;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.coyote.http11.AbstractHttp11Protocol;
import org.apache.coyote.http2.Http2Protocol;
@@ -52,30 +53,19 @@ class CompressionConnectorCustomizerTests {
}
@Test
void shouldCustomizeCompressionForHttp1AndHttp2Protocol() {
void shouldCustomizeCompression() throws LifecycleException {
CompressionConnectorCustomizer compressionConnectorCustomizer = new CompressionConnectorCustomizer(
this.compression);
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.addUpgradeProtocol(new Http2Protocol());
Http2Protocol upgradeProtocol = new Http2Protocol();
upgradeProtocol.setHttp11Protocol((AbstractHttp11Protocol<?>) connector.getProtocolHandler());
connector.addUpgradeProtocol(upgradeProtocol);
compressionConnectorCustomizer.customize(connector);
AbstractHttp11Protocol<?> abstractHttp11Protocol = (AbstractHttp11Protocol<?>) connector.getProtocolHandler();
verifyHttp1(abstractHttp11Protocol);
Http2Protocol http2Protocol = (Http2Protocol) connector.findUpgradeProtocols()[0];
verifyHttp2Upgrade(http2Protocol);
}
private void verifyHttp1(AbstractHttp11Protocol<?> protocol) {
compressionOn(protocol.getCompression());
minSize(protocol.getCompressionMinSize());
mimeType(protocol.getCompressibleMimeTypes());
excludedUserAgents(protocol.getNoCompressionUserAgents());
}
private void verifyHttp2Upgrade(Http2Protocol protocol) {
compressionOn(protocol.getCompression());
minSize(protocol.getCompressionMinSize());
mimeType(protocol.getCompressibleMimeTypes());
excludedUserAgents(protocol.getNoCompressionUserAgents());
compressionOn(abstractHttp11Protocol.getCompression());
minSize(abstractHttp11Protocol.getCompressionMinSize());
mimeType(abstractHttp11Protocol.getCompressibleMimeTypes());
excludedUserAgents(abstractHttp11Protocol.getNoCompressionUserAgents());
}
private void compressionOn(String compression) {

View File

@@ -23,13 +23,15 @@ import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory;
import org.apache.coyote.http11.Http11NioProtocol;
import org.apache.tomcat.util.net.SSLHostConfig;
import org.apache.tomcat.util.net.SSLHostConfigCertificate;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -129,7 +131,8 @@ class SslConnectorCustomizerTests {
ssl.setKeyPassword("password");
ssl.setTrustStore("src/test/resources/test.jks");
SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class);
given(sslStoreProvider.getKeyStore()).willReturn(loadStore());
KeyStore keyStore = loadStore();
given(sslStoreProvider.getKeyStore()).willReturn(keyStore);
SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl, sslStoreProvider);
Connector connector = this.tomcat.getConnector();
customizer.customize(connector);
@@ -137,8 +140,9 @@ class SslConnectorCustomizerTests {
SSLHostConfig sslHostConfig = connector.getProtocolHandler().findSslHostConfigs()[0];
SSLHostConfig sslHostConfigWithDefaults = new SSLHostConfig();
assertThat(sslHostConfig.getTruststoreFile()).isEqualTo(sslHostConfigWithDefaults.getTruststoreFile());
assertThat(sslHostConfig.getCertificateKeystoreFile())
.isEqualTo(SslStoreProviderUrlStreamHandlerFactory.KEY_STORE_URL);
Set<SSLHostConfigCertificate> certificates = sslHostConfig.getCertificates();
assertThat(certificates).hasSize(1);
assertThat(certificates.iterator().next().getCertificateKeystore()).isEqualTo(keyStore);
}
@Test
@@ -147,7 +151,8 @@ class SslConnectorCustomizerTests {
ssl.setKeyPassword("password");
ssl.setKeyStore("src/test/resources/test.jks");
SslStoreProvider sslStoreProvider = mock(SslStoreProvider.class);
given(sslStoreProvider.getTrustStore()).willReturn(loadStore());
KeyStore trustStore = loadStore();
given(sslStoreProvider.getTrustStore()).willReturn(trustStore);
SslConnectorCustomizer customizer = new SslConnectorCustomizer(ssl, sslStoreProvider);
Connector connector = this.tomcat.getConnector();
customizer.customize(connector);
@@ -156,10 +161,11 @@ class SslConnectorCustomizerTests {
sslHostConfig.getCertificates(true);
SSLHostConfig sslHostConfigWithDefaults = new SSLHostConfig();
sslHostConfigWithDefaults.getCertificates(true);
assertThat(sslHostConfig.getTruststoreFile())
.isEqualTo(SslStoreProviderUrlStreamHandlerFactory.TRUST_STORE_URL);
assertThat(sslHostConfig.getCertificateKeystoreFile())
.contains(sslHostConfigWithDefaults.getCertificateKeystoreFile());
assertThat(sslHostConfig.getTruststore()).isEqualTo(trustStore);
System.out.println(sslHostConfig.getCertificates(false).stream()
.map(SSLHostConfigCertificate::getCertificateFile).collect(Collectors.toList()));
System.out.println(sslHostConfigWithDefaults.getCertificates(false).stream()
.map(SSLHostConfigCertificate::getCertificateFile).collect(Collectors.toList()));
}
@Test
@@ -186,37 +192,6 @@ class SslConnectorCustomizerTests {
.withMessageContaining("Could not load key store 'null'");
}
@Test
void keyStorePasswordIsNotSetWhenNull() {
Http11NioProtocol protocol = (Http11NioProtocol) this.tomcat.getConnector().getProtocolHandler();
protocol.setKeystorePass("password");
Ssl ssl = new Ssl();
ssl.setKeyStore("src/test/resources/test.jks");
new SslConnectorCustomizer(ssl, null).customize(this.tomcat.getConnector());
assertThat(protocol.getKeystorePass()).isEqualTo("password");
}
@Test
void keyPasswordIsNotSetWhenNull() {
Http11NioProtocol protocol = (Http11NioProtocol) this.tomcat.getConnector().getProtocolHandler();
protocol.setKeyPass("password");
Ssl ssl = new Ssl();
ssl.setKeyStore("src/test/resources/test.jks");
new SslConnectorCustomizer(ssl, null).customize(this.tomcat.getConnector());
assertThat(protocol.getKeyPass()).isEqualTo("password");
}
@Test
void trustStorePasswordIsNotSetWhenNull() {
Http11NioProtocol protocol = (Http11NioProtocol) this.tomcat.getConnector().getProtocolHandler();
protocol.setTruststorePass("password");
Ssl ssl = new Ssl();
ssl.setKeyStore("src/test/resources/test.jks");
ssl.setTrustStore("src/test/resources/test.jks");
new SslConnectorCustomizer(ssl, null).customize(this.tomcat.getConnector());
assertThat(protocol.getTruststorePass()).isEqualTo("password");
}
private KeyStore loadStore() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
KeyStore keyStore = KeyStore.getInstance("JKS");
Resource resource = new ClassPathResource("test.jks");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -32,13 +32,14 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration.Dynamic;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRegistration.Dynamic;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.catalina.Container;
import org.apache.catalina.Context;

View File

@@ -30,7 +30,8 @@ import java.util.concurrent.atomic.AtomicReference;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import javax.servlet.ServletRegistration.Dynamic;
import jakarta.servlet.ServletRegistration.Dynamic;
import io.undertow.Undertow;
import io.undertow.Undertow.Builder;

View File

@@ -44,7 +44,7 @@ import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.awaitility.Awaitility;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.util.StringContentProvider;
import org.eclipse.jetty.client.util.StringRequestContent;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.junit.jupiter.api.AfterEach;
@@ -492,7 +492,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
client.start();
try {
ContentResponse response = client.POST("http://localhost:" + this.webServer.getPort())
.content(new StringContentProvider("Hello World"), "text/plain").send();
.body(new StringRequestContent("text/plain", "Hello World")).send();
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value());
assertThat(response.getContentAsString()).isEqualTo("Hello World");
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -23,10 +23,10 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.ServletContext;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,10 +16,10 @@
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import org.junit.jupiter.api.Test;

View File

@@ -19,12 +19,12 @@ package org.springframework.boot.web.servlet;
import java.io.IOException;
import java.util.EnumSet;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import jakarta.servlet.Filter;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet;
import javax.servlet.MultipartConfigElement;
import jakarta.servlet.MultipartConfigElement;
import org.junit.jupiter.api.Test;

View File

@@ -16,7 +16,7 @@
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import jakarta.servlet.Filter;
import org.springframework.boot.testsupport.classpath.ClassPathExclusions;
import org.springframework.boot.web.servlet.mock.MockFilter;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -25,10 +25,10 @@ import java.util.Map;
import java.util.Properties;
import java.util.stream.Stream;
import javax.servlet.MultipartConfigElement;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebListener;
import javax.servlet.annotation.WebServlet;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.annotation.WebFilter;
import jakarta.servlet.annotation.WebListener;
import jakarta.servlet.annotation.WebServlet;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.io.TempDir;

View File

@@ -16,15 +16,15 @@
package org.springframework.boot.web.servlet;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpSessionIdListener;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpSessionIdListener;
import org.junit.jupiter.api.Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,8 +18,8 @@ package org.springframework.boot.web.servlet;
import java.util.EventListener;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextListener;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextListener;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

View File

@@ -22,10 +22,10 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import javax.servlet.FilterRegistration;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import jakarta.servlet.FilterRegistration;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletRegistration;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

View File

@@ -21,14 +21,14 @@ import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebFilter;
import jakarta.servlet.annotation.WebInitParam;
import org.junit.jupiter.api.Test;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@@ -18,9 +18,9 @@ package org.springframework.boot.web.servlet;
import java.io.IOException;
import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
import javax.servlet.annotation.WebListener;
import jakarta.servlet.ServletContextAttributeEvent;
import jakarta.servlet.ServletContextAttributeListener;
import jakarta.servlet.annotation.WebListener;
import org.junit.jupiter.api.Test;

View File

@@ -19,9 +19,9 @@ package org.springframework.boot.web.servlet;
import java.io.IOException;
import java.util.Map;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import jakarta.servlet.annotation.WebInitParam;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import org.junit.jupiter.api.Test;

View File

@@ -16,11 +16,11 @@
package org.springframework.boot.web.servlet.context;
import javax.servlet.GenericServlet;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import jakarta.servlet.GenericServlet;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

View File

@@ -23,14 +23,14 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Properties;
import javax.servlet.DispatcherType;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;

Some files were not shown because too many files have changed in this diff Show More