Commit Graph

1972 Commits

Author SHA1 Message Date
Andy Wilkinson
8a0f0354df Disable Log4J2's shutdown hook by default
Log4J2 enables its shutdown hook by default. When the JVM is exiting,
this creates a race between logging that happens during the
application context being closed and Log4J2 being shut down such that
the logging is lost.

This commit updates SpringBootConfigurationFactory so that it
produces a custom sub-class of DefaultConfiguration that disables the
shutdown hook by default. In addition to solving the problem described
above, this also aligns the Log4J2 logging system with the
logging.register-shutdown-hook property which defaults to false.

Closes gh-11360
2018-06-21 11:35:20 +01:00
Andy Wilkinson
9f7106c778 Polish 2018-06-20 18:56:14 +01:00
Andy Wilkinson
6cc0968b8d Polish 2018-06-20 16:52:18 +01:00
Phillip Webb
2bb7a430cf Clean up access logging threads when Undertow is stopped
Closes gh-12742
2018-06-20 14:15:21 +01:00
Andy Wilkinson
92f62043d4 Fix placeholder support in <springProfile>'s name attribute
Closes gh-13450
2018-06-20 10:48:55 +01:00
Spring Buildmaster
36b8639853 Next Development Version 2018-06-14 10:05:31 +00:00
Phillip Webb
6c7289b822 Allow META-INF/resources in WAR classes folder
Update `TomcatResources` so that `META-INF/resources` folders in
`src/main/resources` no longer fail with a "URI is not hierarchical"
exception.

Closes gh-13265
2018-06-05 17:00:52 -07:00
Phillip Webb
5243adce22 Restore Java 1.6 compatibility 2018-05-30 18:23:17 -07:00
Phillip Webb
00b76490dc Remove error logging on ClientAbortException
Update `ErrorPageFilter` so that a Tomcat `ClientAbortException` no
longer causes "Cannot forward to error page for request" logging for
committed responses. Since a `ClientAbortException` indicates that the
client is no longer available it's of no consequence that the request
has been committed and the forward will fail.

Closes gh-13221
2018-05-30 14:00:55 -07:00
Phillip Webb
43071b9375 Polish formatting 2018-05-30 13:34:15 -07:00
Andy Wilkinson
64158ebaf5 Reinstate use of ConversionService for String -> File conversion
Prior to 3db5c70b, RelaxedDataBinder would use a ConversionService
to convert a String into a File via its ObjectToObjectConverter.
3db5c70b changed the configuration of the data binder such that a
FileEditor was registered. Property editors take precedence over any
conversion service so the FileEditor was used instead. This caused a
regression as the FileEditor uses slightly unusual logic for a String
to File conversion. Specifically, when given a value of ".", it will
locate a ClassPathResource for the root of the classpath and use the
result of calling getFile() on that resource. This fails when the
root of the classpath is in a jar file and also provides a different
result when the root of the classpath is not the current directory.

This commit updates RelaxedDataBinder to suppress the registration
of an editor for File. This restores the behaviour prior to 3db5c70b
by allowing the ConversionService to be used instead.

Closes gh-12786
2018-05-17 11:38:48 +01:00
Andy Wilkinson
339fd74810 Call ServletContextListener.contextDestroyed() when Undertow is stopped
Previously, when the embedded Undertow container was stopped, the
servlet deployment was stopped but it was not undeployed. This meant
that contextDestroyed() callback of any registered
ServletContextListeners was not called.

This commit updates UndertowEmbeddedServletContainer to call undeploy
on the deployment manager in addition to the existing call to stop.
Undeploying the servlet deployment calls Undertow to drive the
contextDestroyed callback on any registered ServletContextListeners.

Closes gh-13134
2018-05-14 19:56:08 +01:00
Andy Wilkinson
1fc2eba98b Polish "Suppress debug log output during Logback initialization"
See gh-12071
2018-05-14 18:01:12 +01:00
imgx64
8f44bb9d42 Suppress debug log output during Logback initialization
Closes gh-12071
2018-05-14 17:57:12 +01:00
Andy Wilkinson
a9645a3d07 Polish 2018-05-11 13:29:04 +01:00
Andy Wilkinson
678e125720 Polish "Unwrap InvocationTargetException in isLogConfigurationMessage"
Closes gh-12958
2018-05-11 11:51:18 +01:00
Henri Tremblay
2953ed1dca Unwrap InvocationTargetException in isLogConfigurationMessage
See gh-12958
2018-05-11 11:51:02 +01:00
Andy Wilkinson
c8b3cea200 Clarify that registration bean URL patterns use Servlet spec format
Closes gh-13080
2018-05-10 15:45:16 +01:00
Spring Buildmaster
010b4fccbd Next development version 2018-05-09 09:31:46 +00:00
Phillip Webb
99dad81e9a Update copyright header year for changed files 2018-05-04 12:15:13 -07:00
Phillip Webb
0a0247975c Formatting 2018-05-04 12:00:50 -07:00
Andy Wilkinson
bea353962c Align Undertow tests with changes made to fix UNDERTOW-1260
Closes gh-13055
2018-05-04 13:45:01 +01:00
Phillip Webb
4e96587dc8 Polish modifier declaration ordering
Follow that Java language specification.
2018-05-03 09:46:15 -07:00
Phillip Webb
64930d4e5b Polish caught exception names
Prefer `ex` over `e`.
2018-05-03 09:46:15 -07:00
Phillip Webb
3ee777e142 Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the
the check.
2018-05-03 09:46:15 -07:00
Andy Wilkinson
06cf698387 Polish 2018-05-02 12:12:47 +01:00
Andy Wilkinson
a29a70d2f4 Fix handling of static resource jar paths containing a +
Closes gh-12942
2018-05-02 10:23:42 +01:00
Andy Wilkinson
c78bc0585c Make tests' detection of SSL handshake failures more robust
Closes gh-12961
2018-04-25 11:47:36 +01:00
Spring Buildmaster
c10aad165f Next Development Version 2018-04-09 23:14:33 +00:00
Andy Wilkinson
a06de4d997 Stop error page filter from commiting response prematurely
Previously, the error page filter used sendError to set the response
status when handling an exception and before forwarding the request
to the error controller. Following the fix for gh-11814, this meant
that the error controller was unable to write its response and the
containers default error page was returned instead.

This commit updates the error page filter to use setStatus rather than
sendError. This ensures that the response has the correct status code
while allowing the error controller to write its body. Tests have
been added to the Tomcat deployment test suite to verify that the
error page filter behaves as intended when dealing with a sent error
and an exception for requests accepting HTML, JSON, or anything.

Closes gh-12787
2018-04-09 16:14:27 +01:00
Spring Buildmaster
ade4760842 Next Development Version 2018-04-05 09:01:52 +00:00
Andy Wilkinson
c4923d6273 Ignore existing output when asserting captured log output
Closes gh-12734
2018-04-04 14:14:45 +01:00
Andy Wilkinson
ac88a60071 Ensure error is sent before Writer or OutputStream is used
Previously, ErrorPageFilter's ErrorResponseWrapper would delaying
sending an error back to the client. In cases where the response's
Writer or OutputStream was accessed and flushed or closed, this could
lead to the wrong response status being sent.

This commit updates ErrorResponseWrapper so that it will send any
capture error to the client before returning the response's Writer or
OutputStream. This ensures that closing the Writer or OutputStream
does not cause the response to be committed with the default response
status rather than the previously captured error status.

Such responses will now include the correct status, but will not be
forwarded to the error controller. Such forwarding is not possible
due to the response already having been committed.

Closes gh-11814
2018-04-04 13:49:08 +01:00
Andy Wilkinson
dee8750aff Stop Jetty in Jetty8JettyEmbeddedServletContainerFactoryTests
Closes gh-12734
2018-04-03 15:53:00 +01:00
Andy Wilkinson
edc00eef24 Ensure that Tomcat is completely stopped when its initialization fails
Closes gh-12736
2018-04-03 15:53:00 +01:00
Andy Wilkinson
30de75c75c Ensure that Jetty is completely stopped when it fails to start
Closes gh-12735
2018-04-03 15:53:00 +01:00
Andy Wilkinson
6078fdaed8 Polish "Use modifiable set for @ServletComponentScan with no packages"
Closes gh-12715
2018-04-03 10:47:28 +01:00
Wenwei Liao
7bec780281 Use modifiable set for @ServletComponentScan with no packages
Previously, when a project contained multiple `@ServletComponentScan`
annotated classes in classpath, and at least one annotation don't
explicitly specify `basePackages` and `basePackageClass` attribute,
the application could fail to start with an
UnsupportedOperationException. The failure occurred due to the
creating of an unmodifiable set when no base packages are configured
and a subsequent attempt to add base packages to that sit.

This commit fixes the issue by removing the use of an unmodifiable set
when `@ServletComponentScan` with no base packages in processed before
any other `@ServletComponentScan` annotations.

See gh-12715
2018-04-03 10:47:18 +01:00
Phillip Webb
a8f366a554 Fix copyright header for edited files 2018-03-16 15:07:23 -07:00
Stephane Nicoll
4e3d0f5b33 Fix parsing of value with comma
Closes gh-12297
2018-03-01 17:26:20 +01:00
Andy Wilkinson
452492183d Polish
Closes gh-11991
2018-02-28 14:48:11 +00:00
Andy Wilkinson
88423c504b Polish "Fix handling of static resource jars with spaces in their paths"
Closes gh-11991
2018-02-28 10:40:43 +00:00
Rupert Madden-Abbott
9cd1a4b07a Fix handling of static resource jars with spaces in their paths
See gh-11991
2018-02-28 09:46:29 +00:00
Andy Wilkinson
eaf3789540 Polish "Set host when creating Jetty SSL connector"
Closes gh-12120
2018-02-27 14:39:59 +00:00
mtrejo
f0905ffaf6 Set host when creating Jetty SSL connector
See gh-12120
2018-02-27 14:39:45 +00:00
Phillip Webb
98f58caeaf Reset default local after test completes 2018-02-26 22:22:21 -08:00
Phillip Webb
8f9c067a92 Polish 2018-02-26 22:16:08 -08:00
Madhura Bhave
257e324bd5 Add tests for binding to enum with different locale
See gh-12213
2018-02-26 12:28:28 -08:00
Stephane Nicoll
b4a7e1d64b Use toLowerCase() and toUpperCase() with Locale.ENGLISH
This commit updates all `toLowerCase()` and `toUpperCase` invocations to
use the variant that takes a `Locale` to avoid locale-specific side
effect.

Closes gh-12213
2018-02-26 17:49:03 +01:00
Stephane Nicoll
3db5c70b58 Make sure binder properly resolve resources
This commit makes sure that `@ConfigurationProperties` binding resolves
resources properly. In particular, any `ProtocolResolver` registered on
the `ApplicationContext` is now honoured.

Closes gh-11569
2018-02-20 14:10:22 +01:00