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
ff602e60
Commit
ff602e60
authored
Jun 14, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change default version of Jetty to 9.3
Closes gh-5825
parent
e1cafb16
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
113 additions
and
64 deletions
+113
-64
pom.xml
spring-boot-dependencies/pom.xml
+1
-12
getting-started.adoc
spring-boot-docs/src/main/asciidoc/getting-started.adoc
+8
-4
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+59
-2
README.adoc
spring-boot-samples/README.adoc
+2
-2
pom.xml
spring-boot-samples/pom.xml
+1
-1
pom.xml
spring-boot-samples/spring-boot-sample-jetty92/pom.xml
+4
-4
SampleJetty92Application.java
...rc/main/java/sample/jetty92/SampleJetty92Application.java
+4
-4
HelloWorldService.java
...c/main/java/sample/jetty92/service/HelloWorldService.java
+2
-2
SampleController.java
...92/src/main/java/sample/jetty92/web/SampleController.java
+2
-2
application.properties
...-sample-jetty92/src/main/resources/application.properties
+2
-0
SampleJetty92ApplicationTests.java
...st/java/sample/jetty92/SampleJetty92ApplicationTests.java
+2
-2
JettyEmbeddedServletContainerFactory.java
.../embedded/jetty/JettyEmbeddedServletContainerFactory.java
+26
-29
No files found.
spring-boot-dependencies/pom.xml
View file @
ff602e60
...
@@ -107,7 +107,7 @@
...
@@ -107,7 +107,7 @@
<jedis.version>
2.8.1
</jedis.version>
<jedis.version>
2.8.1
</jedis.version>
<jersey.version>
2.23
</jersey.version>
<jersey.version>
2.23
</jersey.version>
<jest.version>
2.0.3
</jest.version>
<jest.version>
2.0.3
</jest.version>
<jetty.version>
9.
2.17
.v20160517
</jetty.version>
<jetty.version>
9.
3.9
.v20160517
</jetty.version>
<jetty-jsp.version>
2.2.0.v201112011158
</jetty-jsp.version>
<jetty-jsp.version>
2.2.0.v201112011158
</jetty-jsp.version>
<jmustache.version>
1.12
</jmustache.version>
<jmustache.version>
1.12
</jmustache.version>
<jna.version>
4.2.2
</jna.version>
<jna.version>
4.2.2
</jna.version>
...
@@ -1546,17 +1546,6 @@
...
@@ -1546,17 +1546,6 @@
<artifactId>
jetty-io
</artifactId>
<artifactId>
jetty-io
</artifactId>
<version>
${jetty.version}
</version>
<version>
${jetty.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-jsp
</artifactId>
<version>
${jetty.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.eclipse.jetty.orbit
</groupId>
<artifactId>
javax.servlet
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-jmx
</artifactId>
<artifactId>
jetty-jmx
</artifactId>
...
...
spring-boot-docs/src/main/asciidoc/getting-started.adoc
View file @
ff602e60
...
@@ -37,9 +37,9 @@ diverge from the defaults.
...
@@ -37,9 +37,9 @@ diverge from the defaults.
[[getting-started-system-requirements]]
[[getting-started-system-requirements]]
== System Requirements
== System Requirements
By default, Spring Boot {spring-boot-version} requires http://www.java.com[Java 7] and
By default, Spring Boot {spring-boot-version} requires http://www.java.com[Java 7] and
Spring Framework {spring-version} or above. You can use Spring Boot with Java 6 with some
additional
Spring Framework {spring-version} or above. You can use Spring Boot with Java 6 with some
configuration. See <<howto.adoc#howto-use-java-6>> for more details. Explicit build suppor
t
additional configuration. See <<howto.adoc#howto-use-java-6>> for more details. Explici
t
is provided for Maven (3.2+) and Gradle (1.12+).
build support
is provided for Maven (3.2+) and Gradle (1.12+).
TIP: Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if at
TIP: Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if at
all possible.
all possible.
...
@@ -58,7 +58,11 @@ The following embedded servlet containers are supported out of the box:
...
@@ -58,7 +58,11 @@ The following embedded servlet containers are supported out of the box:
|3.0
|3.0
|Java 6+
|Java 6+
|Jetty 9
|Jetty 9.3
|3.1
|Java 8+
|Jetty 9.2
|3.1
|3.1
|Java 7+
|Java 7+
...
...
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
ff602e60
...
@@ -920,10 +920,67 @@ You can change the Tomcat version by setting the `tomcat.version` property:
...
@@ -920,10 +920,67 @@ You can change the Tomcat version by setting the `tomcat.version` property:
[[howto-use-jetty-9.2]]
=== Use Jetty 9.2
Jetty 9.2 works with Spring Boot, but the default is to use Jetty 9.3. If you cannot use
Jetty 9.3 (for example, because you are using Java 7) you will need to change your
classpath to reference Jetty 9.2.
[[howto-use-jetty-9.2-maven]]
==== Use Jetty 9.2 with Maven
If you are using the starters and parent you can just add the Jetty starter and override
the `jetty.version` property:
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<properties>
<jetty.version>9.2.17.v20160517</jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>
----
[[howto-use-jetty-9.2-gradle]]
==== Use Jetty 9.2 with Gradle
You can set the `jetty.version` property. For example, for a simple webapp or service:
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
----
ext['jetty.version'] = '9.2.17.v20160517'
dependencies {
compile ('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
compile ('org.springframework.boot:spring-boot-starter-jetty')
}
----
[[howto-use-jetty-8]]
[[howto-use-jetty-8]]
=== Use Jetty 8
=== Use Jetty 8
Jetty 8 works with Spring Boot, but the default is to use Jetty 9. If you cannot use
Jetty 8 works with Spring Boot, but the default is to use Jetty 9.
3.
If you cannot use
Jetty 9 (for example, because you are using Java 1.6) you will need to change your
Jetty 9
.3
(for example, because you are using Java 1.6) you will need to change your
classpath to reference Jetty 8. You will also need to exclude Jetty's WebSocket-related
classpath to reference Jetty 8. You will also need to exclude Jetty's WebSocket-related
dependencies.
dependencies.
...
...
spring-boot-samples/README.adoc
View file @
ff602e60
...
@@ -117,8 +117,8 @@ The following sample applications are provided:
...
@@ -117,8 +117,8 @@ The following sample applications are provided:
| link:spring-boot-sample-jetty8-ssl[spring-boot-sample-jetty8-ssl]
| link:spring-boot-sample-jetty8-ssl[spring-boot-sample-jetty8-ssl]
| Embedded Jetty 8 SSL
| Embedded Jetty 8 SSL
| link:spring-boot-sample-jetty9
3[spring-boot-sample-jetty93
]
| link:spring-boot-sample-jetty9
2[spring-boot-sample-jetty92
]
| Embedded Jetty 9.
3
| Embedded Jetty 9.
2
| link:spring-boot-sample-jooq[spring-boot-sample-jooq]
| link:spring-boot-sample-jooq[spring-boot-sample-jooq]
| Stores data using jOOQ
| Stores data using jOOQ
...
...
spring-boot-samples/pom.xml
View file @
ff602e60
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
<module>
spring-boot-sample-jetty-ssl
</module>
<module>
spring-boot-sample-jetty-ssl
</module>
<module>
spring-boot-sample-jetty8
</module>
<module>
spring-boot-sample-jetty8
</module>
<module>
spring-boot-sample-jetty8-ssl
</module>
<module>
spring-boot-sample-jetty8-ssl
</module>
<module>
spring-boot-sample-jetty9
3
</module>
<module>
spring-boot-sample-jetty9
2
</module>
<module>
spring-boot-sample-jooq
</module>
<module>
spring-boot-sample-jooq
</module>
<module>
spring-boot-sample-jpa
</module>
<module>
spring-boot-sample-jpa
</module>
<module>
spring-boot-sample-jta-atomikos
</module>
<module>
spring-boot-sample-jta-atomikos
</module>
...
...
spring-boot-samples/spring-boot-sample-jetty9
3
/pom.xml
→
spring-boot-samples/spring-boot-sample-jetty9
2
/pom.xml
View file @
ff602e60
...
@@ -7,9 +7,9 @@
...
@@ -7,9 +7,9 @@
<artifactId>
spring-boot-samples
</artifactId>
<artifactId>
spring-boot-samples
</artifactId>
<version>
1.4.0.BUILD-SNAPSHOT
</version>
<version>
1.4.0.BUILD-SNAPSHOT
</version>
</parent>
</parent>
<artifactId>
spring-boot-sample-jetty9
3
</artifactId>
<artifactId>
spring-boot-sample-jetty9
2
</artifactId>
<name>
Spring Boot Jetty 9.
3
Sample
</name>
<name>
Spring Boot Jetty 9.
2
Sample
</name>
<description>
Spring Boot Jetty 9.
3
Sample
</description>
<description>
Spring Boot Jetty 9.
2
Sample
</description>
<url>
http://projects.spring.io/spring-boot/
</url>
<url>
http://projects.spring.io/spring-boot/
</url>
<organization>
<organization>
<name>
Pivotal Software, Inc.
</name>
<name>
Pivotal Software, Inc.
</name>
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
</organization>
</organization>
<properties>
<properties>
<main.basedir>
${basedir}/../..
</main.basedir>
<main.basedir>
${basedir}/../..
</main.basedir>
<jetty.version>
9.
3.0.v20150612
</jetty.version>
<jetty.version>
9.
2.17.v20160517
</jetty.version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
...
...
spring-boot-samples/spring-boot-sample-jetty9
3/src/main/java/sample/jetty93/SampleJetty93
Application.java
→
spring-boot-samples/spring-boot-sample-jetty9
2/src/main/java/sample/jetty92/SampleJetty92
Application.java
View file @
ff602e60
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -14,16 +14,16 @@
...
@@ -14,16 +14,16 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
sample
.
jetty9
3
;
package
sample
.
jetty9
2
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
@SpringBootApplication
public
class
SampleJetty9
3
Application
{
public
class
SampleJetty9
2
Application
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SpringApplication
.
run
(
SampleJetty9
3
Application
.
class
,
args
);
SpringApplication
.
run
(
SampleJetty9
2
Application
.
class
,
args
);
}
}
}
}
spring-boot-samples/spring-boot-sample-jetty9
3/src/main/java/sample/jetty93
/service/HelloWorldService.java
→
spring-boot-samples/spring-boot-sample-jetty9
2/src/main/java/sample/jetty92
/service/HelloWorldService.java
View file @
ff602e60
/*
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
6
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.
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
sample
.
jetty9
3
.
service
;
package
sample
.
jetty9
2
.
service
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
...
spring-boot-samples/spring-boot-sample-jetty9
3/src/main/java/sample/jetty93
/web/SampleController.java
→
spring-boot-samples/spring-boot-sample-jetty9
2/src/main/java/sample/jetty92
/web/SampleController.java
View file @
ff602e60
...
@@ -14,9 +14,9 @@
...
@@ -14,9 +14,9 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
sample
.
jetty9
3
.
web
;
package
sample
.
jetty9
2
.
web
;
import
sample.jetty9
3
.service.HelloWorldService
;
import
sample.jetty9
2
.service.HelloWorldService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
...
...
spring-boot-samples/spring-boot-sample-jetty9
3
/src/main/resources/application.properties
→
spring-boot-samples/spring-boot-sample-jetty9
2
/src/main/resources/application.properties
View file @
ff602e60
server.compression.enabled
:
true
server.compression.enabled
:
true
server.compression.min-response-size
:
1
server.compression.min-response-size
:
1
\ No newline at end of file
spring-boot-samples/spring-boot-sample-jetty9
3/src/test/java/sample/jetty93/SampleJetty93
ApplicationTests.java
→
spring-boot-samples/spring-boot-sample-jetty9
2/src/test/java/sample/jetty92/SampleJetty92
ApplicationTests.java
View file @
ff602e60
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
* limitations under the License.
* limitations under the License.
*/
*/
package
sample
.
jetty9
3
;
package
sample
.
jetty9
2
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
...
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
(
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
)
@DirtiesContext
@DirtiesContext
public
class
SampleJetty9
3
ApplicationTests
{
public
class
SampleJetty9
2
ApplicationTests
{
@LocalServerPort
@LocalServerPort
private
int
port
;
private
int
port
;
...
...
spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java
View file @
ff602e60
...
@@ -48,11 +48,11 @@ import org.eclipse.jetty.server.SessionManager;
...
@@ -48,11 +48,11 @@ import org.eclipse.jetty.server.SessionManager;
import
org.eclipse.jetty.server.SslConnectionFactory
;
import
org.eclipse.jetty.server.SslConnectionFactory
;
import
org.eclipse.jetty.server.handler.ErrorHandler
;
import
org.eclipse.jetty.server.handler.ErrorHandler
;
import
org.eclipse.jetty.server.handler.HandlerWrapper
;
import
org.eclipse.jetty.server.handler.HandlerWrapper
;
import
org.eclipse.jetty.server.handler.gzip.GzipHandler
;
import
org.eclipse.jetty.server.session.HashSessionManager
;
import
org.eclipse.jetty.server.session.HashSessionManager
;
import
org.eclipse.jetty.servlet.ErrorPageErrorHandler
;
import
org.eclipse.jetty.servlet.ErrorPageErrorHandler
;
import
org.eclipse.jetty.servlet.ServletHolder
;
import
org.eclipse.jetty.servlet.ServletHolder
;
import
org.eclipse.jetty.servlet.ServletMapping
;
import
org.eclipse.jetty.servlet.ServletMapping
;
import
org.eclipse.jetty.servlets.gzip.GzipHandler
;
import
org.eclipse.jetty.util.resource.JarResource
;
import
org.eclipse.jetty.util.resource.JarResource
;
import
org.eclipse.jetty.util.resource.Resource
;
import
org.eclipse.jetty.util.resource.Resource
;
import
org.eclipse.jetty.util.ssl.SslContextFactory
;
import
org.eclipse.jetty.util.ssl.SslContextFactory
;
...
@@ -752,50 +752,47 @@ public class JettyEmbeddedServletContainerFactory
...
@@ -752,50 +752,47 @@ public class JettyEmbeddedServletContainerFactory
private
static
class
Jetty92GzipHandlerFactory
implements
GzipHandlerFactory
{
private
static
class
Jetty92GzipHandlerFactory
implements
GzipHandlerFactory
{
@Override
public
HandlerWrapper
createGzipHandler
(
Compression
compression
)
{
GzipHandler
gzipHandler
=
new
GzipHandler
();
gzipHandler
.
setMinGzipSize
(
compression
.
getMinResponseSize
());
gzipHandler
.
addIncludedMimeTypes
(
compression
.
getMimeTypes
());
if
(
compression
.
getExcludedUserAgents
()
!=
null
)
{
gzipHandler
.
setExcluded
(
new
HashSet
<
String
>(
Arrays
.
asList
(
compression
.
getExcludedUserAgents
())));
}
return
gzipHandler
;
}
}
private
static
class
Jetty93GzipHandlerFactory
implements
GzipHandlerFactory
{
@Override
@Override
public
HandlerWrapper
createGzipHandler
(
Compression
compression
)
{
public
HandlerWrapper
createGzipHandler
(
Compression
compression
)
{
try
{
try
{
Class
<?>
handlerClass
=
ClassUtils
.
forName
(
GZIP_HANDLER_JETTY_9_
3
,
Class
<?>
handlerClass
=
ClassUtils
.
forName
(
GZIP_HANDLER_JETTY_9_
2
,
getClass
().
getClassLoader
());
getClass
().
getClassLoader
());
HandlerWrapper
h
andler
=
(
HandlerWrapper
)
handlerClass
.
newInstance
();
HandlerWrapper
gzipH
andler
=
(
HandlerWrapper
)
handlerClass
.
newInstance
();
ReflectionUtils
.
findMethod
(
handlerClass
,
"setMinGzipSize"
,
int
.
class
)
ReflectionUtils
.
findMethod
(
handlerClass
,
"setMinGzipSize"
,
int
.
class
)
.
invoke
(
h
andler
,
compression
.
getMinResponseSize
());
.
invoke
(
gzipH
andler
,
compression
.
getMinResponseSize
());
ReflectionUtils
ReflectionUtils
.
findMethod
(
handlerClass
,
"
set
IncludedMimeTypes"
,
String
[].
class
)
.
findMethod
(
handlerClass
,
"
add
IncludedMimeTypes"
,
String
[].
class
)
.
invoke
(
h
andler
,
new
Object
[]
{
compression
.
getMimeTypes
()
});
.
invoke
(
gzipH
andler
,
new
Object
[]
{
compression
.
getMimeTypes
()
});
if
(
compression
.
getExcludedUserAgents
()
!=
null
)
{
if
(
compression
.
getExcludedUserAgents
()
!=
null
)
{
ReflectionUtils
ReflectionUtils
.
findMethod
(
handlerClass
,
"setExcluded"
,
Set
.
class
)
.
findMethod
(
handlerClass
,
"setExcludedAgentPatterns"
,
.
invoke
(
gzipHandler
,
new
HashSet
<
String
>(
String
[].
class
)
Arrays
.
asList
(
compression
.
getExcludedUserAgents
())));
.
invoke
(
handler
,
new
Object
[]
{
compression
.
getExcludedUserAgents
()
});
}
}
return
h
andler
;
return
gzipH
andler
;
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
"Failed to configure Jetty 9.
3
gzip handler"
,
throw
new
RuntimeException
(
"Failed to configure Jetty 9.
2
gzip handler"
,
ex
);
ex
);
}
}
}
}
}
}
private
static
class
Jetty93GzipHandlerFactory
implements
GzipHandlerFactory
{
@Override
public
HandlerWrapper
createGzipHandler
(
Compression
compression
)
{
GzipHandler
handler
=
new
GzipHandler
();
handler
.
setMinGzipSize
(
compression
.
getMinResponseSize
());
handler
.
setIncludedMimeTypes
(
compression
.
getMimeTypes
());
if
(
compression
.
getExcludedUserAgents
()
!=
null
)
{
handler
.
setExcludedAgentPatterns
(
compression
.
getExcludedUserAgents
());
}
return
handler
;
}
}
/**
/**
* {@link JettyServerCustomizer} to add {@link ForwardedRequestCustomizer}. Only
* {@link JettyServerCustomizer} to add {@link ForwardedRequestCustomizer}. Only
* supported with Jetty 9 (hence the inner class)
* supported with Jetty 9 (hence the inner class)
...
...
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