Commit Graph

1962 Commits

Author SHA1 Message Date
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
Andy Wilkinson 145d8d2673 Defer removal of Connectors until after ServletContext initialization
Previously, we removed the Connectors from Tomcat's Service before
the Context was started. The removal of the Connectors is required as
it prevents Tomcat from accepting requests before we're ready to
handle them.

Part of starting the Context is creating and initializing the
ServletContext. ServerProperties uses a ServletContextInitializer to
set the session tracking modes and Tomcat rejects the SSL tracking
mode if there is no SSL-enabled connector available. With the previous
arrangement this led to a failure as the Connectors had been removed
so the SSL-enabled connector could not be found.

This commit updates the embedded Tomcat container to defer the
removal of the Connectors until after the context has been started
but still at a point that is before the Connectors themselves would
have been started.

Closes gh-12058
2018-02-14 17:04:55 +00:00
Stephane Nicoll 2f6d05dc51 Fix parsing of String value in json
Closes gh-11992
2018-02-12 17:05:32 +01:00
Stephane Nicoll da01744e4c Merge pull request #11981 from eiselems:1.5.xMysqlValidationQuery
* pr/11981:
  Update MySQL validation query to use lightweight ping
  Polish
  Reinject mocks when context is dirtied before each method
  Polish “Prevent reverse name lookup when configuring Jetty's address”
  Prevent reverse name lookup when configuring Jetty's address
  Fixup version numbers following release
  Next Development Version
  Protect against symlink attacks
  All CLI support for Windows MINGW environments
  Polish
2018-02-10 15:05:58 +01:00
Marcus Eisele 37ce1784ab Update MySQL validation query to use lightweight ping
Closes gh-11981
2018-02-10 15:04:29 +01:00
Andy Wilkinson dc1e1e8280 Polish “Prevent reverse name lookup when configuring Jetty's address”
Closes gh-11889
2018-02-10 15:03:53 +01:00
Henrich Kraemer dc48a90184 Prevent reverse name lookup when configuring Jetty's address
Previously, the host on Jetty's connector was configured using the
host address of the InetSocketAddress. This could result in reverse
name resolution that could cause Jetty to bind to a different IP
address than was configured.

This commit updates the configuration code to use the host string
when specifically does not perform reverse name resolution.

See gh-11889
2018-02-10 15:03:53 +01:00
Spring Buildmaster aa6cb9744b Next Development Version 2018-02-10 15:03:53 +01:00
Phillip Webb af8e155c6d Polish 2018-02-10 15:03:53 +01:00
Phillip Webb 798522d890 Format with Eclipse Oxygen SR2 2018-02-08 15:46:49 -08:00
Andy Wilkinson a1b823fc43 Polish “Prevent reverse name lookup when configuring Jetty's address”
Closes gh-11889
2018-02-02 14:55:57 +00:00