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
9f010ed8
Commit
9f010ed8
authored
May 26, 2015
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.2.x'
parents
3423972c
160f2d34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
28 deletions
+48
-28
GzipFilterProperties.java
...ramework/boot/autoconfigure/web/GzipFilterProperties.java
+34
-18
GzipFilterAutoConfigurationTests.java
...t/autoconfigure/web/GzipFilterAutoConfigurationTests.java
+10
-7
appendix-application-properties.adoc
...cs/src/main/asciidoc/appendix-application-properties.adoc
+4
-3
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterProperties.java
View file @
9f010ed8
...
...
@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils;
* Properties for configuring {@link GzipFilter}.
*
* @author Andy Wilkinson
* @author Stephane Nicoll
* @since 1.2.2
*/
@ConfigurationProperties
(
prefix
=
"spring.http.gzip"
)
...
...
@@ -67,6 +68,11 @@ public class GzipFilterProperties {
*/
private
List
<
MimeType
>
mimeTypes
;
/**
* Comma-separated list of MIME types to exclude from compression.
*/
private
List
<
MimeType
>
excludedMimeTypes
;
/**
* Comma-separated list of user agents to exclude from compression. String.contains is
* used to determine a match against the request's User-Agent header.
...
...
@@ -77,19 +83,19 @@ public class GzipFilterProperties {
* Comma-separated list of regular expression patterns to control user agents excluded
* from compression.
*/
private
String
exclude
d
AgentPatterns
;
private
String
excludeAgentPatterns
;
/**
* Comma-separated list of paths to exclude from compression. Uses String.startsWith
* to determine a match against the request's path.
*/
private
String
exclude
d
Paths
;
private
String
excludePaths
;
/**
* Comma-separated list of regular expression patterns to control the paths that are
* excluded from compression.
*/
private
String
exclude
d
PathPatterns
;
private
String
excludePathPatterns
;
/**
* Vary header sent on responses that may be compressed.
...
...
@@ -156,6 +162,16 @@ public class GzipFilterProperties {
this
.
mimeTypes
=
mimeTypes
;
}
public
List
<
MimeType
>
getExcludedMimeTypes
()
{
return
excludedMimeTypes
;
}
public
void
setExcludedMimeTypes
(
List
<
MimeType
>
excludedMimeTypes
)
{
this
.
addInitParameter
(
"excludedMimeTypes"
,
StringUtils
.
collectionToCommaDelimitedString
(
excludedMimeTypes
));
this
.
excludedMimeTypes
=
excludedMimeTypes
;
}
public
String
getExcludedAgents
()
{
return
this
.
excludedAgents
;
}
...
...
@@ -165,31 +181,31 @@ public class GzipFilterProperties {
this
.
excludedAgents
=
excludedAgents
;
}
public
String
getExclude
d
AgentPatterns
()
{
return
this
.
exclude
d
AgentPatterns
;
public
String
getExcludeAgentPatterns
()
{
return
this
.
excludeAgentPatterns
;
}
public
void
setExclude
dAgentPatterns
(
String
excluded
AgentPatterns
)
{
this
.
addInitParameter
(
"exclude
dAgentPatterns"
,
excluded
AgentPatterns
);
this
.
exclude
dAgentPatterns
=
excluded
AgentPatterns
;
public
void
setExclude
AgentPatterns
(
String
exclude
AgentPatterns
)
{
this
.
addInitParameter
(
"exclude
AgentPatterns"
,
exclude
AgentPatterns
);
this
.
exclude
AgentPatterns
=
exclude
AgentPatterns
;
}
public
String
getExclude
d
Paths
()
{
return
this
.
exclude
d
Paths
;
public
String
getExcludePaths
()
{
return
this
.
excludePaths
;
}
public
void
setExclude
dPaths
(
String
excluded
Paths
)
{
this
.
addInitParameter
(
"exclude
dPaths"
,
excluded
Paths
);
this
.
exclude
dPaths
=
excluded
Paths
;
public
void
setExclude
Paths
(
String
exclude
Paths
)
{
this
.
addInitParameter
(
"exclude
Paths"
,
exclude
Paths
);
this
.
exclude
Paths
=
exclude
Paths
;
}
public
String
getExclude
d
PathPatterns
()
{
return
this
.
exclude
d
PathPatterns
;
public
String
getExcludePathPatterns
()
{
return
this
.
excludePathPatterns
;
}
public
void
setExclude
dPathPatterns
(
String
excluded
PathPatterns
)
{
this
.
addInitParameter
(
"exclude
dPathPatterns"
,
excluded
PathPatterns
);
this
.
exclude
dPathPatterns
=
excluded
PathPatterns
;
public
void
setExclude
PathPatterns
(
String
exclude
PathPatterns
)
{
this
.
addInitParameter
(
"exclude
PathPatterns"
,
exclude
PathPatterns
);
this
.
exclude
PathPatterns
=
exclude
PathPatterns
;
}
public
String
getVary
()
{
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfigurationTests.java
View file @
9f010ed8
...
...
@@ -69,14 +69,15 @@ public class GzipFilterAutoConfigurationTests {
"spring.http.gzip.deflateNoWrap:false"
,
"spring.http.gzip.methods:GET,POST"
,
"spring.http.gzip.mimeTypes:application/foo,application/bar"
,
"spring.http.gzip.excludedMimeTypes:application/biz"
,
"spring.http.gzip.excludedAgents:excluded-agent-1,excluded-agent-2"
,
"spring.http.gzip.exclude
d
AgentPatterns:agent-pattern-1,agent-pattern-2"
,
"spring.http.gzip.exclude
d
Paths:/static/"
,
"spring.http.gzip.exclude
d
PathPatterns:path-pattern"
,
"spring.http.gzip.excludeAgentPatterns:agent-pattern-1,agent-pattern-2"
,
"spring.http.gzip.excludePaths:/static/"
,
"spring.http.gzip.excludePathPatterns:path-pattern"
,
"spring.http.gzip.vary:vary-header-value"
);
FilterRegistrationBean
registrationBean
=
this
.
context
.
getBean
(
"gzipFilter"
,
FilterRegistrationBean
.
class
);
assertThat
(
registrationBean
.
getInitParameters
().
size
(),
equalTo
(
1
2
));
assertThat
(
registrationBean
.
getInitParameters
().
size
(),
equalTo
(
1
3
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"checkGzExists"
),
equalTo
(
"false"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"bufferSize"
),
...
...
@@ -91,13 +92,15 @@ public class GzipFilterAutoConfigurationTests {
equalTo
(
"GET,POST"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"mimeTypes"
),
equalTo
(
"application/foo,application/bar"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"excludedMimeTypes"
),
equalTo
(
"application/biz"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"excludedAgents"
),
equalTo
(
"excluded-agent-1,excluded-agent-2"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"exclude
d
AgentPatterns"
),
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"excludeAgentPatterns"
),
equalTo
(
"agent-pattern-1,agent-pattern-2"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"exclude
d
Paths"
),
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"excludePaths"
),
equalTo
(
"/static/"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"exclude
d
PathPatterns"
),
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"excludePathPatterns"
),
equalTo
(
"path-pattern"
));
assertThat
(
registrationBean
.
getInitParameters
().
get
(
"vary"
),
equalTo
(
"vary-header-value"
));
...
...
spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
View file @
9f010ed8
...
...
@@ -136,11 +136,12 @@ content into your application; rather pick only the properties that you need.
spring.http.gzip.deflate-no-wrap= # noWrap setting for deflate compression (true or false)
spring.http.gzip.enabled=true # enable gzip filter support
spring.http.gzip.excluded-agents= # comma-separated list of user agents to exclude from compression
spring.http.gzip.exclude
d
-agent-patterns= # comma-separated list of regular expression patterns to control user agents excluded from compression
spring.http.gzip.exclude
d
-paths= # comma-separated list of paths to exclude from compression
spring.http.gzip.exclude
d
-path-patterns= # comma-separated list of regular expression patterns to control the paths that are excluded from compression
spring.http.gzip.exclude-agent-patterns= # comma-separated list of regular expression patterns to control user agents excluded from compression
spring.http.gzip.exclude-paths= # comma-separated list of paths to exclude from compression
spring.http.gzip.exclude-path-patterns= # comma-separated list of regular expression patterns to control the paths that are excluded from compression
spring.http.gzip.methods= # comma-separated list of HTTP methods for which compression is enabled
spring.http.gzip.mime-types= # comma-separated list of MIME types which should be compressed
spring.http.gzip.excluded-mime-types= # comma-separated list of MIME types to exclude from compression
spring.http.gzip.min-gzip-size= # minimum content length required for compression to occur
spring.http.gzip.vary= # Vary header to be sent on responses that may be compressed
...
...
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