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
9fcc8609
Commit
9fcc8609
authored
Aug 06, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish contribution
Closes gh-3643
parent
7568af17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
WebMvcAutoConfiguration.java
...ework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
+2
-2
WebMvcAutoConfigurationTests.java
.../boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
+28
-0
OrderedHttpPutFormContentFilter.java
...ork/boot/context/web/OrderedHttpPutFormContentFilter.java
+2
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java
View file @
9fcc8609
...
...
@@ -107,13 +107,13 @@ public class WebMvcAutoConfiguration {
@Bean
@ConditionalOnMissingBean
(
HiddenHttpMethodFilter
.
class
)
public
HiddenHttpMethodFilter
hiddenHttpMethodFilter
()
{
public
Ordered
HiddenHttpMethodFilter
hiddenHttpMethodFilter
()
{
return
new
OrderedHiddenHttpMethodFilter
();
}
@Bean
@ConditionalOnMissingBean
(
HttpPutFormContentFilter
.
class
)
public
HttpPutFormContentFilter
httpPutFormContentFilter
()
{
public
Ordered
HttpPutFormContentFilter
httpPutFormContentFilter
()
{
return
new
OrderedHttpPutFormContentFilter
();
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfigurationTests.java
View file @
9fcc8609
...
...
@@ -41,6 +41,7 @@ import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebAppl
import
org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor
;
import
org.springframework.boot.context.embedded.EmbeddedServletContainerFactory
;
import
org.springframework.boot.context.embedded.MockEmbeddedServletContainerFactory
;
import
org.springframework.boot.context.web.OrderedHttpPutFormContentFilter
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -51,6 +52,7 @@ import org.springframework.mock.web.MockHttpServletRequest;
import
org.springframework.test.util.ReflectionTestUtils
;
import
org.springframework.util.ReflectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.filter.HttpPutFormContentFilter
;
import
org.springframework.web.servlet.HandlerAdapter
;
import
org.springframework.web.servlet.HandlerMapping
;
import
org.springframework.web.servlet.LocaleResolver
;
...
...
@@ -441,6 +443,22 @@ public class WebMvcAutoConfigurationTests {
assertEquals
(
123456L
,
actual
);
}
@Test
public
void
httpPutFormContentFilterIsAutoConfigured
()
{
load
();
assertThat
(
this
.
context
.
getBeansOfType
(
OrderedHttpPutFormContentFilter
.
class
)
.
size
(),
is
(
equalTo
(
1
)));
}
@Test
public
void
httpPutFormContentFilterCanBeOverridden
()
{
load
(
CustomHttpPutFormContentFilter
.
class
);
assertThat
(
this
.
context
.
getBeansOfType
(
OrderedHttpPutFormContentFilter
.
class
)
.
size
(),
is
(
equalTo
(
0
)));
assertThat
(
this
.
context
.
getBeansOfType
(
HttpPutFormContentFilter
.
class
).
size
(),
is
(
equalTo
(
1
)));
}
@SuppressWarnings
(
"unchecked"
)
private
void
load
(
Class
<?>
config
,
String
...
environment
)
{
this
.
context
=
new
AnnotationConfigEmbeddedWebApplicationContext
();
...
...
@@ -552,4 +570,14 @@ public class WebMvcAutoConfigurationTests {
}
@Configuration
static
class
CustomHttpPutFormContentFilter
{
@Bean
public
HttpPutFormContentFilter
customHttpPutFormContentFilter
()
{
return
new
HttpPutFormContentFilter
();
}
}
}
spring-boot/src/main/java/org/springframework/boot/context/web/OrderedHttpPutFormContentFilter.java
View file @
9fcc8609
...
...
@@ -25,7 +25,8 @@ import org.springframework.web.filter.HttpPutFormContentFilter;
* @author Joao Pedro Evangelista
* @since 1.3.0
*/
public
class
OrderedHttpPutFormContentFilter
extends
HttpPutFormContentFilter
implements
Ordered
{
public
class
OrderedHttpPutFormContentFilter
extends
HttpPutFormContentFilter
implements
Ordered
{
/**
* Higher order to ensure the filter is applied before Spring Security.
...
...
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