-
Notifications
You must be signed in to change notification settings - Fork 40.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the structure of the response and include mappings from WebFlux and Servlet and Filter registrations in addition to the mappings from Spring MVC. Closes gh-9979
- Loading branch information
1 parent
1f26a03
commit 67a2990
Showing
46 changed files
with
1,905 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...ct/spring-boot-actuator-autoconfigure/src/main/asciidoc/endpoints/mappings.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
[[mappings]] | ||
= Mappings (`mappings`) | ||
|
||
The `mappings` endpoint provides information about the application's request mappings. | ||
|
||
|
||
|
||
[[mappings-retrieving]] | ||
== Retrieving the Mappings | ||
|
||
To retrieve the mappings, make a `GET` request to `/actuator/mappings`, as shown in the | ||
following curl-based example: | ||
|
||
include::{snippets}mappings/curl-request.adoc[] | ||
|
||
The resulting response is similar to the following: | ||
|
||
include::{snippets}mappings/http-response.adoc[] | ||
|
||
|
||
|
||
[[mappings-retrieving-response-structure]] | ||
=== Response Structure | ||
|
||
The response contains details of the application's mappings. The items found in the | ||
response depend on the type of web application (reactive or Servlet-based). The | ||
following table describes the structure of the common elements of the response: | ||
|
||
[cols="2,1,3"] | ||
include::{snippets}mappings/response-fields.adoc[] | ||
|
||
The entries that may be found in `contexts.*.mappings` are described in the | ||
following sections. | ||
|
||
|
||
[[mappings-retrieving-response-structure-dispatcher-servlets]] | ||
=== Dispatcher Servlets Response Structure | ||
|
||
When using Spring MVC, the response contains details of any `DispatcherServlet` | ||
request mappings beneath `contexts.*.mappings.dispatcherServlets`. The following | ||
table describes the structure of this section of the response: | ||
|
||
[cols="2,1,3"] | ||
include::{snippets}mappings/response-fields-dispatcher-servlets.adoc[] | ||
|
||
|
||
|
||
[[mappings-retrieving-response-structure-servlets]] | ||
=== Servlets Response Structure | ||
|
||
When using the Servlet stack, the response contains details of any `Servlet` mappings | ||
beneath `contexts.*.mappings.servlets`. The following table describes the structure of | ||
this section of the response: | ||
|
||
[cols="2,1,3"] | ||
include::{snippets}mappings/response-fields-servlets.adoc[] | ||
|
||
|
||
|
||
[[mappings-retrieving-response-structure-servlet-filters]] | ||
=== Servlet Filters Response Structure | ||
|
||
When using the Servlet stack, the response contains details of any `Filter` mappings | ||
beneath `contexts.*.mappings.servletFilters`. The following table describes the | ||
structure of this section of the response: | ||
|
||
[cols="2,1,3"] | ||
include::{snippets}mappings/response-fields-servlet-filters.adoc[] | ||
|
||
|
||
|
||
[[mappings-retrieving-response-structure-dispatcher-servlets]] | ||
=== Dispatcher Handlers Response Structure | ||
|
||
When using Spring WebFlux, the response contains details of any `DispatcherHandler` | ||
request mappings beneath `contexts.*.mappings.dispatcherHandlers`. The following | ||
table describes the structure of this section of the response: | ||
|
||
[cols="2,1,3"] | ||
include::{snippets}mappings/response-fields-dispatcher-handlers.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...org/springframework/boot/actuate/autoconfigure/web/MappingsEndpointAutoConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* Copyright 2012-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.boot.actuate.autoconfigure.web; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
import org.springframework.beans.factory.ObjectProvider; | ||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint; | ||
import org.springframework.boot.actuate.web.MappingDescriptionProvider; | ||
import org.springframework.boot.actuate.web.MappingsEndpoint; | ||
import org.springframework.boot.actuate.web.reactive.DispatcherHandlersMappingDescriptionProvider; | ||
import org.springframework.boot.actuate.web.servlet.DispatcherServletsMappingDescriptionProvider; | ||
import org.springframework.boot.actuate.web.servlet.FiltersMappingDescriptionProvider; | ||
import org.springframework.boot.actuate.web.servlet.ServletsMappingDescriptionProvider; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.reactive.DispatcherHandler; | ||
import org.springframework.web.servlet.DispatcherServlet; | ||
|
||
/** | ||
* {@link EnableAutoConfiguration Auto-configuration} for {@link MappingsEndpoint}. | ||
* | ||
* @author Andy Wilkinson | ||
* @since 2.0.0 | ||
*/ | ||
@ManagementContextConfiguration | ||
public class MappingsEndpointAutoConfiguration { | ||
|
||
@Bean | ||
@ConditionalOnEnabledEndpoint | ||
public MappingsEndpoint mappingsEndpoint(ApplicationContext applicationContext, | ||
ObjectProvider<Collection<MappingDescriptionProvider>> descriptionProviders) { | ||
return new MappingsEndpoint( | ||
descriptionProviders.getIfAvailable(Collections::emptyList), | ||
applicationContext); | ||
} | ||
|
||
@Configuration | ||
@ConditionalOnWebApplication(type = Type.SERVLET) | ||
static class ServletWebConfiguration { | ||
|
||
@Bean | ||
ServletsMappingDescriptionProvider servletMappingDescriptionProvider() { | ||
return new ServletsMappingDescriptionProvider(); | ||
} | ||
|
||
@Bean | ||
FiltersMappingDescriptionProvider filterMappingDescriptionProvider() { | ||
return new FiltersMappingDescriptionProvider(); | ||
} | ||
|
||
@Configuration | ||
@ConditionalOnClass(DispatcherServlet.class) | ||
@ConditionalOnBean(DispatcherServlet.class) | ||
static class SpringMvcConfiguration { | ||
|
||
@Bean | ||
DispatcherServletsMappingDescriptionProvider dispatcherServletMappingDescriptionProvider( | ||
ApplicationContext applicationContext) { | ||
return new DispatcherServletsMappingDescriptionProvider(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
@Configuration | ||
@ConditionalOnWebApplication(type = Type.REACTIVE) | ||
@ConditionalOnClass(DispatcherHandler.class) | ||
@ConditionalOnBean(DispatcherHandler.class) | ||
static class ReactiveWebConfiguration { | ||
|
||
@Bean | ||
public DispatcherHandlersMappingDescriptionProvider dispatcherHandlerMappingDescriptionProvider( | ||
ApplicationContext applicationContext) { | ||
return new DispatcherHandlersMappingDescriptionProvider(); | ||
} | ||
|
||
} | ||
|
||
} |
152 changes: 0 additions & 152 deletions
152
...va/org/springframework/boot/actuate/autoconfigure/web/servlet/RequestMappingEndpoint.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.