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
9b5af810
Commit
9b5af810
authored
Jan 16, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-19774
parents
f06af5a7
4c8626ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
JettyServletWebServerFactory.java
...boot/web/embedded/jetty/JettyServletWebServerFactory.java
+2
-2
JettyServletWebServerFactoryTests.java
...web/embedded/jetty/JettyServletWebServerFactoryTests.java
+23
-1
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java
View file @
9b5af810
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -327,9 +327,9 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
ServletContextInitializer
...
initializers
)
{
List
<
Configuration
>
configurations
=
new
ArrayList
<>();
configurations
.
add
(
getServletContextInitializerConfiguration
(
webAppContext
,
initializers
));
configurations
.
addAll
(
getConfigurations
());
configurations
.
add
(
getErrorPageConfiguration
());
configurations
.
add
(
getMimeTypeConfiguration
());
configurations
.
addAll
(
getConfigurations
());
return
configurations
.
toArray
(
new
Configuration
[
0
]);
}
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java
View file @
9b5af810
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -35,8 +35,10 @@ 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
;
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.Configuration
;
import
org.eclipse.jetty.webapp.WebAppContext
;
import
org.junit.jupiter.api.Test
;
...
...
@@ -301,4 +303,24 @@ class JettyServletWebServerFactoryTests extends AbstractJettyServletWebServerFac
});
}
@Test
void
errorHandlerCanBeOverridden
()
{
JettyServletWebServerFactory
factory
=
getFactory
();
factory
.
addConfigurations
(
new
AbstractConfiguration
()
{
@Override
public
void
configure
(
WebAppContext
context
)
throws
Exception
{
context
.
setErrorHandler
(
new
CustomErrorHandler
());
}
});
JettyWebServer
jettyWebServer
=
(
JettyWebServer
)
factory
.
getWebServer
();
WebAppContext
context
=
(
WebAppContext
)
jettyWebServer
.
getServer
().
getHandler
();
assertThat
(
context
.
getErrorHandler
()).
isInstanceOf
(
CustomErrorHandler
.
class
);
}
private
static
class
CustomErrorHandler
extends
ErrorPageErrorHandler
{
}
}
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