292 Commits

Author SHA1 Message Date
Andy Wilkinson
cced3514a7 Polish 2018-07-11 17:49:10 +01:00
Stephane Nicoll
3423c5dddb Detect DispatcherServlets registered via ServletRegistrationBean
Previously, when a DispatcherServlet was registered via a
ServletRegistrationBean, the mappings endpoint did not expose any
information about it as it wasn't detected.

This commit fixes the detection of available DispatcherServlets in the
context so that the mappings endpoint include them all.

Closes gh-13186
2018-07-10 17:06:36 +02:00
Johnny Lim
46e6aa5963 Fix query string encoding in TraceableHttpServletRequest
Closes gh-13545
2018-07-10 15:56:10 +02:00
Johnny Lim
0de8317979 Separate logging from getUrlMappings()
Closes gh-13710
2018-07-10 15:27:43 +02:00
Johnny Lim
ab6adc8265 Polish
Closes gh-13616
2018-07-09 10:45:01 +02:00
Madhura Bhave
fddc9e9c7e Support multiple paths in DispatcherServletPathProvider
Closes gh-13603
2018-06-28 12:36:58 -07:00
Andy Wilkinson
a5d20ffed7 Avoid NPE when creating method tag for WebFlux req with non-standard method
Previously, a NullPointerException would occur when WebFluxTags
attempted to create a method Tag for a request with a non-standard
method.

This commit updates WebFluxTags to use getMethodValue(), which will
never return null, rather than getMethod(), which may return null,
when determining the tag's value for the given request.

Closes gh-13596
2018-06-28 14:27:02 +01:00
Andy Wilkinson
911453d478 Merge branch '1.5.x' into 2.0.x 2018-06-25 11:25:10 +01:00
Madhura Bhave
ed734d7e43 Trace filter ignores invalid requests
Fixes gh-12987
2018-06-07 09:27:49 -07:00
Phillip Webb
571c50e43f Switch to functional web code to use static imports
Update the samples and tests to use the more idiomatic static import
style.
2018-06-04 17:27:34 -07:00
Madhura Bhave
60a4d67b13 Handle special characters in TraceableHttpServletRequest
Fixes gh-13273
2018-06-04 12:50:11 -07:00
Andy Wilkinson
ea51cfabca Avoid uri tag explosion when use of path variable is undetected
Previously, WebMvcTags would fall back to using the request’s path
info if Spring MVC’s best matching path pattern attribute was not
available. For non-Spring MVC web frameworks that support path
variables, such as Jersey, this led to an explosion of URI tags that
could exhaust the heap.

Closes gh-12447
2018-06-04 15:43:48 +01:00
Stephane Nicoll
faa9910e46 Enable cache when a SecurityContext parameter is used
This commit restores caching for the main read operation when the
SecurityContext does not expose a principal (i.e. guest access).

Closes gh-13238
2018-05-29 15:56:22 +02:00
Stephane Nicoll
4259817572 Fix extension discovery when endpoint instance is sub-classed
This commit fixes endpoint extension discovery when the related endpoint
is sub-classed. Previously, a strict by type check was applied against
the `endpoint` attribute of `EndpointExtension`.

Rather than using a `Class` check, this commit extracts the id of an
endpoint and uses it to match its extension, if any.

Closes gh-13082
2018-05-29 14:12:23 +02:00
Johnny Lim
bd2053aa17 Use more Tag constants
Closes gh-13286
2018-05-29 09:32:26 +02:00
Johnny Lim
f385a1cb11 Polish
Closes gh-13243
2018-05-28 09:36:15 +02:00
Phillip Webb
2dc4f1df00 Polish 2018-05-21 21:32:42 -07:00
Johnny Lim
75639aa682 Polish
Closes gh-13192
2018-05-17 15:29:50 +02:00
Stephane Nicoll
2be1c8f527 Polish "Set classloader for JMX endpoints to application classloader"
Closes gh-12209
2018-05-14 17:41:47 +02:00
David Herberth
e44c81672f Set classloader for JMX endpoints to application classloader
See gh-12209
2018-05-14 17:41:31 +02:00
dreis2211
e6a23fa3ff Remove unnecessary semicolons
Closes gh-13144
2018-05-11 14:23:47 +02:00
Andy Wilkinson
c826310fd1 Polish 2018-05-09 08:44:15 +01:00
Phillip Webb
975e986fef Polish 2018-05-04 20:06:27 -07:00
Phillip Webb
5b3cb8a698 Update copyright header year for changed files 2018-05-04 15:59:26 -07:00
Phillip Webb
57bfbfb3ad Fix checkstyle errors 2018-05-04 15:58:59 -07:00
Phillip Webb
6e09e497f2 Formatting 2018-05-04 12:06:19 -07:00
Phillip Webb
2d70a7ae5e Polish caught exception names
Prefer `ex` over `e`.
2018-05-03 22:43:32 -07:00
Phillip Webb
41efea51a7 Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the
the check.
2018-05-03 22:43:12 -07:00
Phillip Webb
e125085993 Merge branch '1.5.x' into 2.0.x 2018-05-03 12:43:50 -07:00
Andy Wilkinson
f019d5c85b Merge branch '1.5.x' into 2.0.x 2018-05-02 12:22:04 +01:00
Stephane Nicoll
2b98b11c12 Polish "Less object instantiation in WebMvcTags"
Closes gh-12894
2018-04-18 09:41:40 +02:00
Jon Schneider
d676147680 Less object instantiation in WebMvcTags
See gh-12894
2018-04-18 09:38:23 +02:00
Stephane Nicoll
0bc7bef5e5 Properly handle InvalidEndpointRequestException
This commit makes sure that `InvalidEndpointRequestException` is wrapped
in a `ReflectionException` when invoked via JMX.

Closes gh-12857
2018-04-16 11:33:22 +02:00
dreis2211
2bbf438c36 Fix duplicate words in comments
Closes gh-12866
2018-04-16 08:09:40 +02:00
Stephane Nicoll
fa542bacc0 Translate user-defined exception when invoking JMX operation
This commit makes sure to respect the MBeanServer#invoke contract by
wrapping any user-defined exception in an MBeanException. Also, any
exception not from the JDK is translated, as it may lead to unexpected
issue on the client if that class isn't present. This is consistent
with our operation result mapping strategy.

Closes gh-10448
2018-04-13 16:26:04 +02:00
Brian Clozel
b2e7be17ab Polish gh-11514
As pointed out by Rossen in gh-11514 comments, a handler might commit
the response and then send an error signal in the pipeline. In this
case, adding a callback to `beforeCommit` is useless because it won't be
triggered. In those cases, we need to collect metrics right away.
2018-04-12 22:50:16 +02:00
Brian Clozel
3fa8fe85af Deprecate RouterFunctionMetrics
Spring Boot now deploys both annotation-based and functional endpoints
under the same `HttpHandler`; this means the currently auto-configured
`MetricsWebFilter` is instrumenting all endpoints to produce metrics.

There is no need for a WebFlux functional specific support.
This commit removes mentions of `RouterFunctionMetrics` in the docs and
deprecates that class.

Closes gh-12833
2018-04-12 12:08:44 +02:00
Brian Clozel
77be10e7bc Fix "status" metrics tag for error responses
Prior to this commit, the metrics `WebFilter` would handle exceptions
flowing through the pipeline and extract tag information right away.
Since error handling turns the exception information into error HTTP
responses later in the chain, the information extracted from the
response earlier is invalid.
In this case, the "status" information could be "200" whereas error
handlers would later set that status to "500".

This commit delays the tags extraction later in the process, right
before the response is comitted. The happy path is not changed, as
handlers signal that the response is fully taken care of at that point.

Fixes gh-11514
2018-04-12 11:30:43 +02:00
Stephane Nicoll
e8fac7d9c4 Properly discover endpoints that are proxied
Previously to this commit, if a `@ControllerEndpoint`,
`@RestControllerEndpoint` or `@ServletEndpoint` annotated bean was
proxied, the endpoint wasn't properly detected.

This commit makes sure that annotation retrieval works on the user class
while preserving the get (vs. find) retrieval semantic

Closes gh-12441
2018-04-10 20:23:55 +02:00
Stephane Nicoll
86b96254a1 Migrate to ApplicationContextRunner 2018-04-10 20:23:54 +02:00
Johnny Lim
f03849d502 Polish
See gh-12812
2018-04-10 11:46:16 +02:00
Andy Wilkinson
8d5b9f37d5 Merge branch '1.5.x' 2018-04-09 17:59:53 +01:00
Phillip Webb
598e9bb842 Polish 2018-04-04 18:01:25 -07:00
Brian Clozel
f6d16c8b99 Align WebFluxTags uri support on WebMvcTags
This commit ensures that `WebFluxTags` not only relies on
`BEST_MATCHING_PATTERN_ATTRIBUTE` or request URI to provide the "uri"
tag information.

To avoid cardinality explosion, HTTP not found and redirects are
assigned fixed uri tags.

Closes gh-12685
2018-04-04 11:46:10 +02:00
Phillip Webb
98a2a91d16 Polish 2018-03-29 14:00:13 -07:00
Brian Clozel
ebb2f70e0b Make WebMvgTags use matched patterns for HTTP 404
Prior to this commit, `WebMvcTags' would always mark as "NOT_FOUND" or
"REDIRECTION" *any* exchange with responses of 404 and 3xx status, even
if those responses are actually returned by Controller handlers.

This commit checks inverts those checks and first considers if the
"BEST_MATCHING_PATTERN_ATTRIBUTE" request attribute is present and uses
it - then falls back to "NOT_FOUND" and "REDIRECTION" to avoid
cardinality explosion.

Fixes gh-12577
2018-03-29 20:33:07 +02:00
Madhura Bhave
8b29823885 Prevent StackOverFlowException in metadata processor
Fixes gh-11037
2018-03-28 07:58:13 -07:00
dreis2211
3b0f6e7168 Use Supplier variants of Assert methods
See gh-12630
2018-03-26 17:58:17 +02:00
Johnny Lim
625bf93598 Polish
See gh-12584
2018-03-26 17:33:25 +02:00
Phillip Webb
78534a753d Polish "Iterate map by using lambda function"
See gh-12528
2018-03-19 08:00:36 -04:00