Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
e1ce21c3
Commit
e1ce21c3
authored
Mar 11, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.1.x' into 2.2.x
Closes gh-20499
parents
8e7a5579
2b211371
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
TomcatReactiveWebServerFactory.java
...t/web/embedded/tomcat/TomcatReactiveWebServerFactory.java
+2
-2
TomcatReactiveWebServerFactoryTests.java
.../embedded/tomcat/TomcatReactiveWebServerFactoryTests.java
+17
-1
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java
View file @
e1ce21c3
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -131,7 +131,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac
...
@@ -131,7 +131,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac
}
}
TomcatHttpHandlerAdapter
servlet
=
new
TomcatHttpHandlerAdapter
(
httpHandler
);
TomcatHttpHandlerAdapter
servlet
=
new
TomcatHttpHandlerAdapter
(
httpHandler
);
prepareContext
(
tomcat
.
getHost
(),
servlet
);
prepareContext
(
tomcat
.
getHost
(),
servlet
);
return
new
TomcatWebServer
(
tomcat
,
getPort
()
>=
0
);
return
getTomcatWebServer
(
tomcat
);
}
}
private
void
configureEngine
(
Engine
engine
)
{
private
void
configureEngine
(
Engine
engine
)
{
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactoryTests.java
View file @
e1ce21c3
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -21,6 +21,7 @@ import java.net.InetSocketAddress;
...
@@ -21,6 +21,7 @@ import java.net.InetSocketAddress;
import
java.net.ServerSocket
;
import
java.net.ServerSocket
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicReference
;
import
org.apache.catalina.Context
;
import
org.apache.catalina.Context
;
import
org.apache.catalina.LifecycleEvent
;
import
org.apache.catalina.LifecycleEvent
;
...
@@ -256,6 +257,21 @@ class TomcatReactiveWebServerFactoryTests extends AbstractReactiveWebServerFacto
...
@@ -256,6 +257,21 @@ class TomcatReactiveWebServerFactoryTests extends AbstractReactiveWebServerFacto
.
isInstanceOf
(
WebServerException
.
class
);
.
isInstanceOf
(
WebServerException
.
class
);
}
}
@Test
void
whenGetTomcatWebServerIsOverriddenThenWebServerCreationCanBeCustomized
()
{
AtomicReference
<
TomcatWebServer
>
webServerReference
=
new
AtomicReference
<>();
TomcatWebServer
webServer
=
(
TomcatWebServer
)
new
TomcatReactiveWebServerFactory
()
{
@Override
protected
TomcatWebServer
getTomcatWebServer
(
Tomcat
tomcat
)
{
webServerReference
.
set
(
new
TomcatWebServer
(
tomcat
));
return
webServerReference
.
get
();
}
}.
getWebServer
(
new
EchoHandler
());
assertThat
(
webServerReference
).
hasValue
(
webServer
);
}
private
void
doWithBlockedPort
(
BlockedPortAction
action
)
throws
IOException
{
private
void
doWithBlockedPort
(
BlockedPortAction
action
)
throws
IOException
{
int
port
=
SocketUtils
.
findAvailableTcpPort
(
40000
);
int
port
=
SocketUtils
.
findAvailableTcpPort
(
40000
);
ServerSocket
serverSocket
=
new
ServerSocket
();
ServerSocket
serverSocket
=
new
ServerSocket
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment